[Checkins] SVN: Zope/trunk/ - removed ancient backwards compatibility code

Yvo Schubbe y.2010 at wcm-solutions.de
Thu Jun 17 05:55:12 EDT 2010


Log message for revision 113588:
  - removed ancient backwards compatibility code

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Zope2/App/startup.py
  U   Zope/trunk/src/Zope2/App/tests/testExceptionHook.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2010-06-17 09:03:52 UTC (rev 113587)
+++ Zope/trunk/doc/CHANGES.rst	2010-06-17 09:55:11 UTC (rev 113588)
@@ -11,6 +11,10 @@
 Restructuring
 +++++++++++++
 
+- ZPublisherExceptionHook: Removed ancient backwards compatibility code.
+  Customized raise_standardErrorMessage methods have to implement the
+  signature introduced in Zope 2.6.
+
 - Testing: Functional.publish now uses the real publish_module function
   instead of that from ZPublisher.Test. The 'extra' argument of the publish
   method is no longer supported.

Modified: Zope/trunk/src/Zope2/App/startup.py
===================================================================
--- Zope/trunk/src/Zope2/App/startup.py	2010-06-17 09:03:52 UTC (rev 113587)
+++ Zope/trunk/src/Zope2/App/startup.py	2010-06-17 09:55:11 UTC (rev 113588)
@@ -263,25 +263,20 @@
             if REQUEST.get('AUTHENTICATED_USER', None) is None:
                 REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody
 
-            try:
-                result = f(client, REQUEST, t, v, 
-                           traceback, 
-                           error_log_url=error_log_url)
-                if result is not None:
-                    t, v, traceback = result
-                    if issubclass(t, Unauthorized):
-                        # Re-raise Unauthorized to make sure it is handled
-                        # correctly. We can't do that with all exceptions
-                        # because some don't work with the rendered v as
-                        # argument.
-                        raise t, v, traceback
-                    response = REQUEST.RESPONSE
-                    response.setStatus(t)
-                    response.setBody(v)
-                    return response
-            except TypeError:
-                # BBB: Pre Zope 2.6 call signature
-                f(client, REQUEST, t, v, traceback)
+            result = f(client, REQUEST, t, v, traceback,
+                       error_log_url=error_log_url)
+            if result is not None:
+                t, v, traceback = result
+                if issubclass(t, Unauthorized):
+                    # Re-raise Unauthorized to make sure it is handled
+                    # correctly. We can't do that with all exceptions
+                    # because some don't work with the rendered v as
+                    # argument.
+                    raise t, v, traceback
+                response = REQUEST.RESPONSE
+                response.setStatus(t)
+                response.setBody(v)
+                return response
 
         finally:
             traceback = None

Modified: Zope/trunk/src/Zope2/App/tests/testExceptionHook.py
===================================================================
--- Zope/trunk/src/Zope2/App/tests/testExceptionHook.py	2010-06-17 09:03:52 UTC (rev 113587)
+++ Zope/trunk/src/Zope2/App/tests/testExceptionHook.py	2010-06-17 09:55:11 UTC (rev 113588)
@@ -225,12 +225,6 @@
     def dummyMethod(self):
         return 'Aye'
 
-class OldClient(Client):
-
-    def raise_standardErrorMessage(self, c, r, t, v, tb):
-        from zExceptions.ExceptionFormatter import format_exception
-        self.messages.append(''.join(format_exception(t, v, tb, as_html=0)))
-
 class StandardClient(Client):
 
     def raise_standardErrorMessage(self, c, r, t, v, tb, error_log_url):
@@ -245,17 +239,6 @@
 
 class ExceptionMessageRenderTest(ExceptionHookTestCase):
 
-    def testRenderUnauthorizedOldClient(self):
-        from AccessControl import Unauthorized
-        def f():
-            raise Unauthorized, 1
-        request = self._makeRequest()
-        client = OldClient()
-        self.call(client, request, f)
-        self.failUnless(client.messages, client.messages)
-        tb = client.messages[0]
-        self.failUnless("Unauthorized: You are not allowed" in tb, tb)
-
     def testRenderUnauthorizedStandardClient(self):
         from AccessControl import Unauthorized
         def f():



More information about the checkins mailing list