From 6a98e910a2e64e9f02cb3d7d91d79d5658964e4d Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Thu, 8 Apr 2010 14:46:19 +0000
Subject: [PATCH] if no error page reference is defined do not search documents
 without reference, but return the default one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34396 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/WebSection.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/WebSection.py b/product/ERP5/Document/WebSection.py
index 212c5000cb..8ce1c5ca40 100644
--- a/product/ERP5/Document/WebSection.py
+++ b/product/ERP5/Document/WebSection.py
@@ -113,11 +113,13 @@ class WebSection(Domain, PermanentURLMixIn):
             else:
               request.set(web_param, False)
 
+      document = None
       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 not_found_page_ref is not None:
+          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,
-- 
2.30.9