Skip to content
Snippets Groups Projects
Commit f363859c authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

fix import

parent d3143c94
No related branches found
No related tags found
2 merge requests!836Release,!833Fix article import
Pipeline #15105 passed
from django import forms
from django.utils.safestring import mark_safe
from wagtail.admin.forms import WagtailAdminPageForm
from wagtail.models.collections import Collection
......@@ -29,11 +30,12 @@ class JekyllImportForm(WagtailAdminPageForm):
jekyll_repo_url = forms.URLField(
max_length=512,
required=False,
help_text="V GitHubu tlačítko Code -> a odkaz z Download zip"
"např. 'https://github.com/pirati-web/cb.pirati.cz/archive/refs/heads/gh-pages.zip',"
"pokud máte nainstalovaný Git, zvolte Použít Git a vložte"
"jednoduše URL repozitáře "
"např. 'https://github.com/pirati-web/cb.pirati.cz'",
help_text=mark_safe(
"V GitHubu tlačítko Code -> a odkaz z <strong>Download zip</strong>, "
"např. <em>https://github.com/pirati-web/cb.pirati.cz/archive/refs/heads/gh-pages.zip</em>. "
"Pokud máte nainstalovaný Git, zvolte <strong>Použít Git</strong> a vložte jednoduše "
"URL repozitáře, např. <em>https://github.com/pirati-web/cb.pirati.cz</em>."
)
)
readonly_log = forms.CharField(
disabled=True,
......
......@@ -546,7 +546,7 @@ class JekyllArticleImporter:
r = re.split(r"^---\s*$", f.read(), maxsplit=3, flags=re.MULTILINE)
try:
meta = yaml.safe_load(r[1].replace("\t", ""))
except (ScannerError, ValueError):
except (ScannerError, ValueError, IndexError):
msg = "Nelze importovat článek - neparsovatelný YAML"
logger.warning(msg, extra={"file_path": file_path})
self.page_log += "{} - {}\n".format(msg, file_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment