[Checkins] SVN: zope.errorview/trunk/ no longer by default provide ISystemErrorView in exception views. It would result in duplicate log output.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Feb 8 05:31:39 EST 2011


Log message for revision 120194:
  no longer by default provide ISystemErrorView in exception views. It would result in duplicate log output.

Changed:
  U   zope.errorview/trunk/CHANGES.txt
  U   zope.errorview/trunk/src/zope/errorview/browser.py
  U   zope.errorview/trunk/src/zope/errorview/http.py
  U   zope.errorview/trunk/src/zope/errorview/tests/test_browser.py
  U   zope.errorview/trunk/src/zope/errorview/tests/test_http.py

-=-
Modified: zope.errorview/trunk/CHANGES.txt
===================================================================
--- zope.errorview/trunk/CHANGES.txt	2011-02-08 09:03:22 UTC (rev 120193)
+++ zope.errorview/trunk/CHANGES.txt	2011-02-08 10:31:38 UTC (rev 120194)
@@ -5,9 +5,10 @@
 0.10 (unreleased)
 -----------------
 
-- Nothing changed yet.
+- Exception views do not by default provide ISystemErrorView anymore as it
+  would result in duplicate log output. The mixin class still exists for
+  writing custom error views that do provide ISystemErrorView.
 
-
 0.9 (2011-01-20)
 ----------------
 

Modified: zope.errorview/trunk/src/zope/errorview/browser.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/browser.py	2011-02-08 09:03:22 UTC (rev 120193)
+++ zope.errorview/trunk/src/zope/errorview/browser.py	2011-02-08 10:31:38 UTC (rev 120194)
@@ -21,7 +21,7 @@
 # XXX i18n-ing?
 
 
-class ExceptionView(ExceptionView, BrowserPage):
+class ExceptionView(ExceptionViewBase, BrowserPage):
 
     def render(self):
         return u'A system error occurred.'

Modified: zope.errorview/trunk/src/zope/errorview/http.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/http.py	2011-02-08 09:03:22 UTC (rev 120193)
+++ zope.errorview/trunk/src/zope/errorview/http.py	2011-02-08 10:31:38 UTC (rev 120194)
@@ -20,7 +20,12 @@
 
 
 class SystemErrorViewMixin(object):
+    """An optional mixin to indicate a particular error view to be an "system
+    error" view. This indicates the publication object to log the error again
+    with the error reporting utility.
 
+    """
+
     implements(ISystemErrorView)
 
     def isSystemError(self):
@@ -50,7 +55,7 @@
         return self()
 
 
-class ExceptionView(ExceptionViewBase, SystemErrorViewMixin):
+class ExceptionView(ExceptionViewBase):
     pass
 
 

Modified: zope.errorview/trunk/src/zope/errorview/tests/test_browser.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/tests/test_browser.py	2011-02-08 09:03:22 UTC (rev 120193)
+++ zope.errorview/trunk/src/zope/errorview/tests/test_browser.py	2011-02-08 10:31:38 UTC (rev 120194)
@@ -61,9 +61,6 @@
 
     def test_exceptionview(self):
         view = getMultiAdapter((Exception(), self.request), name='index.html')
-        self.failUnless(IHTTPException.providedBy(view))
-        self.failUnless(ISystemErrorView.providedBy(view))
-        self.assertTrue(view.isSystemError())
         self.assertEquals(view(), 'A system error occurred.')
         self.assertEquals(self.request.response.getStatus(), 500)
 

Modified: zope.errorview/trunk/src/zope/errorview/tests/test_http.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/tests/test_http.py	2011-02-08 09:03:22 UTC (rev 120193)
+++ zope.errorview/trunk/src/zope/errorview/tests/test_http.py	2011-02-08 10:31:38 UTC (rev 120194)
@@ -24,6 +24,7 @@
 from zope.publisher.interfaces.http import MethodNotAllowed, IMethodNotAllowed
 from zope.publisher.interfaces import TraversalException, NotFound
 from zope.security.interfaces import Unauthorized
+
 import zope.errorview
 
 
@@ -42,6 +43,15 @@
     def test_exceptionview(self):
         view = http.ExceptionView(Exception(), self.request)
         self.failUnless(IHTTPException.providedBy(view))
+        self.assertEquals(str(view), '')
+        self.assertEquals(view(), '')
+        self.assertEqual(self.request.response.getStatus(), 500)
+
+    def test_systemerrormixin_view(self):
+        class SystemErrorView(http.ExceptionViewBase, http.SystemErrorViewMixin):
+            pass
+        view = SystemErrorView(Exception(), self.request)
+        self.failUnless(IHTTPException.providedBy(view))
         self.failUnless(ISystemErrorView.providedBy(view))
         self.assertTrue(view.isSystemError())
         self.assertEquals(str(view), '')



More information about the checkins mailing list