Skip to content

Commit

Permalink
explicitly skip adding content_type warnings when path has its own wa…
Browse files Browse the repository at this point in the history
…rning
  • Loading branch information
KeynesYouDigIt committed Jul 14, 2019
1 parent b882cab commit 03fd64c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pyxform/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ def _add_empty_translations(self, warnings=None):
paths[path] = paths.get(path, set()).union(content.keys())

for lang, translation in self._translations.items():
this_path_has_warning = False
for path, content_types in paths.items():
if path not in self._translations[lang]:
self._translations[lang][path] = {}
Expand All @@ -581,15 +582,20 @@ def _add_empty_translations(self, warnings=None):
lang, question_and_column[0], question_and_column[1]
)
warnings.append(missing_warning)
# no need to warn about content types missing translations since the
# whole path has a warning now.
this_path_has_warning = True

for content_type in content_types:
if content_type not in self._translations[lang][path]:
self._translations[lang][path][content_type] = u"-"
# missing question thingy thats like media
missing_warning = self._generate_missing_translation_warning(
lang, path.split(":")[0], content_type
)
warnings.append(missing_warning)
if not this_path_has_warning:
# the path has a translation but the content type is missing one.
missing_warning = self._generate_missing_translation_warning(
lang, path.split(":")[0], content_type
)
warnings.append(missing_warning)

def _generate_missing_translation_warning(self, lang, question_name, column_name):
found_on_msg = (
Expand Down

0 comments on commit 03fd64c

Please sign in to comment.