Skip to content

Commit

Permalink
Warn about missing parent translations in rebuild_page_tree
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Dec 19, 2016
1 parent d4f7f8c commit 4431072
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fluent_pages/management/commands/rebuild_page_tree.py
Expand Up @@ -63,6 +63,13 @@ def handle_noargs(self, **options):
slugs.setdefault(translation.language_code, {})[translation.master_id] = translation.slug
overrides.setdefault(translation.language_code, {})[translation.master_id] = translation.override_url

page = translation.master
if page.parent_id:
if page.parent_id not in slugs[translation.language_code]:
self.stderr.write("WARNING: Parent #{0} is not translated in '{1}', while the child #{2} is.".format(
page.parent_id, translation.language_code, translation.master_id
))

old_url = translation._cached_url
try:
new_url = self._construct_url(translation.language_code, translation.master_id, parents, slugs, overrides)
Expand All @@ -78,7 +85,6 @@ def handle_noargs(self, **options):
if not is_dry_run:
translation.save()

page = translation.master
if old_url != new_url:
self.stdout.write(smart_text(u"{0} {1} {2}\n".format(
col_style.format(
Expand Down

0 comments on commit 4431072

Please sign in to comment.