[Erp5-report] r34393 fabien - /erp5/trunk/products/ERP5/Document/WebSection.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 8 16:28:05 CEST 2010


Author: fabien
Date: Thu Apr  8 16:28:02 2010
New Revision: 34393

URL: http://svn.erp5.org?rev=34393&view=rev
Log:
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

Modified:
    erp5/trunk/products/ERP5/Document/WebSection.py

Modified: erp5/trunk/products/ERP5/Document/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/WebSection.py?rev=34393&r1=34392&r2=34393&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py [utf8] Thu Apr  8 16:28:02 2010
@@ -34,6 +34,7 @@
 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 @@
             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):




More information about the Erp5-report mailing list