0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Catch correct error from resolve_subpage()

This commit is contained in:
Andy Babic 2022-01-10 21:49:08 +00:00 committed by Matt Westcott
parent b88f57ed86
commit e69bccf273

View File

@ -1,7 +1,7 @@
from urllib.parse import urlparse
from django.db import models
from django.urls import NoReverseMatch
from django.urls import Resolver404
from django.utils.translation import gettext_lazy as _
from wagtail.core.models import Page
@ -60,7 +60,7 @@ class Redirect(models.Model):
return base_url
try:
page.resolve_subpage(self.redirect_page_route_path)
except NoReverseMatch:
except Resolver404:
return base_url
return base_url + self.redirect_page_route_path
elif self.redirect_link: