Skip to content
Snippets Groups Projects
Commit 00154e84 authored by OndraRehounek's avatar OndraRehounek Committed by jan.bednarik
Browse files

WIP

parent d82dc466
Branches
No related tags found
2 merge requests!442Release,!432Feature/majak imports
......@@ -3,6 +3,7 @@ import re
import urllib
import xml.etree.ElementTree as ET
import zipfile
from datetime import date
from io import StringIO
from shutil import rmtree
from sys import stdout
......@@ -104,9 +105,15 @@ def import_post(path, file_path, parent, title_suffix, dry_run):
article.text = html
article.perex = get_perex(md)
article.date = meta["date"].split()[0]
meta_date = meta["date"]
if isinstance(meta_date, date):
article.date = meta_date
else:
article.date = meta["date"].split()[0]
article.title = meta["title"]
article.author = meta["author"]
article.author = meta.get("author", "Česká pirátská strana")
article.seo_title = article.title + title_suffix
article.search_description = meta.get("description", "")
......@@ -217,7 +224,7 @@ def perform_import(
site_config = get_site_config(path)
title_suffix = get_title_from_site_config(site_config)
articlepath = site_config["articlepath"]
articlepath = site_config.get("articlepath", "aktuality")
for fn in os.listdir(os.path.join(path, POSTS_DIR)):
fname = os.path.join(POSTS_DIR, fn)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment