[Zope3-checkins] SVN: Zope3/trunk/ Fixed a bug that was hiding INotFoundError exceptions behind an empty

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Dec 22 18:16:32 EST 2005


Log message for revision 40990:
  Fixed a bug that was hiding INotFoundError exceptions behind an empty 
  page.
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  A   Zope3/trunk/src/zope/app/exception/browser/SETUP.cfg
  U   Zope3/trunk/src/zope/app/exception/browser/configure.zcml
  A   Zope3/trunk/src/zope/app/exception/browser/exception-ftesting.zcml
  U   Zope3/trunk/src/zope/app/exception/browser/ftests.py
  U   Zope3/trunk/src/zope/app/exception/browser/systemerror.txt

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/doc/CHANGES.txt	2005-12-22 23:16:31 UTC (rev 40990)
@@ -26,6 +26,9 @@
 
     Bug Fixes
 
+      - Fixed a nasty bug that was hiding ``INotFoundError`` exceptions behind
+        an empty page.
+
       - ZEO didn't work properly with teh twisted server.
 
       - Non-management pages were slowed by a bug in the page-macro

Added: Zope3/trunk/src/zope/app/exception/browser/SETUP.cfg
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/SETUP.cfg	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/src/zope/app/exception/browser/SETUP.cfg	2005-12-22 23:16:31 UTC (rev 40990)
@@ -0,0 +1,5 @@
+# Tell zpkg how to install the ZCML slugs.
+
+<data-files zopeskel/etc/package-includes>
+  exception-ftesting.zcml
+</data-files>

Modified: Zope3/trunk/src/zope/app/exception/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/configure.zcml	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/src/zope/app/exception/browser/configure.zcml	2005-12-22 23:16:31 UTC (rev 40990)
@@ -11,6 +11,14 @@
       />
 
   <page
+      for="zope.exceptions.INotFoundError"
+      name="index.html"
+      template="systemerror.pt"
+      class="..systemerror.SystemErrorView"
+      permission="zope.Public"
+      />
+
+  <page
       for="zope.security.interfaces.IUnauthorized"
       name="index.html"
       permission="zope.Public"

Added: Zope3/trunk/src/zope/app/exception/browser/exception-ftesting.zcml
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/exception-ftesting.zcml	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/src/zope/app/exception/browser/exception-ftesting.zcml	2005-12-22 23:16:31 UTC (rev 40990)
@@ -0,0 +1,11 @@
+<configure
+   xmlns="http://namespaces.zope.org/browser">
+
+  <page
+      for="zope.app.folder.interfaces.IFolder"
+      name="componentlookuperror.html"
+      class="zope.app.exception.browser.ftests.RaiseComponentLookupError"
+      permission="zope.Public"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/exception/browser/exception-ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/exception/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/ftests.py	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/src/zope/app/exception/browser/ftests.py	2005-12-22 23:16:31 UTC (rev 40990)
@@ -17,7 +17,14 @@
 """
 import unittest
 from zope.app.testing import functional
+from zope.component.interfaces import ComponentLookupError
 
+class RaiseComponentLookupError(object):
+
+    def __call__(self):
+        raise ComponentLookupError()
+
+
 class TestNotFound(functional.BrowserTestCase):
 
     def testNotFound(self):
@@ -28,6 +35,7 @@
         self.assert_(
             'The page that you are trying to access is not available' in body)
 
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(TestNotFound),

Modified: Zope3/trunk/src/zope/app/exception/browser/systemerror.txt
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/systemerror.txt	2005-12-22 22:05:06 UTC (rev 40989)
+++ Zope3/trunk/src/zope/app/exception/browser/systemerror.txt	2005-12-22 23:16:31 UTC (rev 40990)
@@ -59,4 +59,17 @@
     A system error occurred.
   ...
 
+Another way of getting a system error is the occurrence of an
+``INotFoundError``, such as ``ComponentLookupError``. I have registered a
+simple view in ``exception-ftesting.zcml`` that will raise a component lookup
+error. So if we call ``componentlookuperror.html``, we should get the error
+message:
 
+  >>> print http(r"""
+  ... GET /componentlookuperror.html HTTP/1.1
+  ... """)
+  HTTP/1.1 500 Internal Server Error
+  ...
+    A system error occurred.
+  ...
+



More information about the Zope3-Checkins mailing list