Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
wil93 committed Oct 5, 2024
1 parent e4172cc commit e656689
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions cmscontrib/loaders/italy_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,26 +390,23 @@ def get_task(self, get_statement=True):
if os.path.exists(path):
multi_statement_paths[lang_code] = path

# Ensure that either a statement.pdf/testo.pdf is specified, or a
# list of <lang>.pdf files are specified, but not both.
if single_statement_path is not None and len(multi_statement_paths) > 0:
# Unless statement.pdf/testo.pdf is a symlink, in which case we
# let it slide
if os.path.islink(single_statement_path):
pass
else:
if len(multi_statement_paths) > 0:
# Ensure that either a statement.pdf or testo.pdf is specified,
# or a list of <lang>.pdf files are specified, but not both,
# unless statement.pdf or testo.pdf is a symlink, in which case
# we let it slide.
if single_statement_path is not None and not os.path.islink(
single_statement_path
):
logger.warning(
f"A statement (not a symlink!) is present at {single_statement_path} "
f"but {len(multi_statement_paths)} more multi-language statements "
"were found. This is likely an error. Proceeding with "
"importing the multi-language files only."
)
single_statement_path = None

if single_statement_path is not None:
statements_to_import = {primary_language: single_statement_path}
else:
statements_to_import = multi_statement_paths
else:
statements_to_import = {primary_language: single_statement_path}

if primary_language not in statements_to_import.keys():
logger.critical(
Expand Down

0 comments on commit e656689

Please sign in to comment.