[FIX] website: website.redirect was never called

Before this commit, the website.redirect records would never been called since
we switched call order from redirect>page to page>redirect.
It would always render a 404 and would never check redirect records.

Now, if there is no page found, it will check for redirects and if no redirect
found it will return 404.
This commit is contained in:
rde
2017-09-27 21:33:50 +02:00
committed by Jeremy Kersten
parent fa23bb8586
commit 257595011d
+5 -1
View File
@@ -121,7 +121,11 @@ class Http(models.AbstractModel):
'deletable': True,
'main_object': mypage,
}, mimetype=_guess_mimetype(ext))
return False
@classmethod
def _serve_404(cls):
req_page = request.httprequest.path
return request.website.is_publisher() and request.render('website.page_404', {'path': req_page[1:]}) or False
@classmethod
@@ -148,7 +152,7 @@ class Http(models.AbstractModel):
if redirect:
return request.redirect(redirect.url_to, code=redirect.type)
return False
return cls._serve_404()
@classmethod
def _handle_exception(cls, exception):