Use correct exception
This commit is contained in:
parent
7707104da4
commit
569f8a3823
|
|
@ -1,3 +1,4 @@
|
|||
from wagtail.actions.copy_for_translation import ParentNotTranslatedError
|
||||
from wagtail.models import Locale, Page
|
||||
|
||||
from books.models.module import Module
|
||||
|
|
@ -53,7 +54,7 @@ def convert_page_to_translation(slug: str, original_slug: str, language_code="en
|
|||
logger.debug("Creating topic translation")
|
||||
try:
|
||||
translated_topic = translate_page(topic, locale)
|
||||
except Page.DoesNotExist:
|
||||
except ParentNotTranslatedError:
|
||||
# let's try to translate the parent page too
|
||||
translate_page(topic.get_parent(), locale)
|
||||
translated_topic = translate_page(topic, locale)
|
||||
|
|
|
|||
Loading…
Reference in New Issue