Commit 185b9a1c authored by Fabien Morin's avatar Fabien Morin

In case a web page is not found, try to get the reference of the 404 web page

define for this web_section and return this web page. If not found, return a
default web_page

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34393 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d887a62f
......@@ -34,6 +34,7 @@ from Products.ERP5.Document.Document import PermanentURLMixIn
from Acquisition import aq_base, aq_inner
from Products.ERP5Type.UnrestrictedMethod import unrestricted_apply
from AccessControl import Unauthorized
from OFS.Traversable import NotFound
from Products.ERP5Type.Cache import getReadOnlyTransactionCache
......@@ -112,7 +113,16 @@ class WebSection(Domain, PermanentURLMixIn):
else:
request.set(web_param, False)
return PermanentURLMixIn.__bobo_traverse__(self, request, name)
try:
document = PermanentURLMixIn.__bobo_traverse__(self, request, name)
except NotFound:
not_found_page_ref = self.getLayoutProperty('layout_not_found_page_reference')
document = PermanentURLMixIn.getDocumentValue(self, name=not_found_page_ref)
if document is None:
# if no document found, fallback on default page template
document = PermanentURLMixIn.__bobo_traverse__(self, request,
'404.error.page')
return document
security.declareProtected(Permissions.AccessContentsInformation, 'getLayoutProperty')
def getLayoutProperty(self, key, default=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment