Skip to content

Commit

Permalink
#162 catch IntegrityError for Wagtail5, too
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Sep 8, 2024
1 parent debce74 commit ee0d93a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cast/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.db import IntegrityError
from django.http import HttpRequest

from .models import TemplateBaseDirectory
Expand All @@ -15,8 +16,9 @@ def site_template_base_dir(request: HttpRequest) -> dict[str, str]:
else:
try:
site_template_base_dir_name = TemplateBaseDirectory.for_request(request).name
except TemplateBaseDirectory.DoesNotExist:
except (TemplateBaseDirectory.DoesNotExist, IntegrityError):
# If the site template base directory does not exist, use the default
# need to catch IntegrityError because of Wagtail5 support
site_template_base_dir_name = DEFAULT_TEMPLATE_BASE_DIR
return {
"cast_site_template_base_dir": site_template_base_dir_name,
Expand Down

0 comments on commit ee0d93a

Please sign in to comment.