Log message for revision 101882:
  Use Tres' handy upgradeException function, to make the ExceptionHookTest work 
across Python versions
  

Changed:
  U   Zope/branches/2.12/src/Zope2/App/startup.py
  U   Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py

-=-
Modified: Zope/branches/2.12/src/Zope2/App/startup.py
===================================================================
--- Zope/branches/2.12/src/Zope2/App/startup.py 2009-07-14 06:33:00 UTC (rev 
101881)
+++ Zope/branches/2.12/src/Zope2/App/startup.py 2009-07-14 08:38:03 UTC (rev 
101882)
@@ -23,6 +23,7 @@
 from App.config import getConfiguration
 from time import asctime
 from types import StringType, ListType
+from zExceptions import upgradeException
 from zExceptions import Redirect
 from zExceptions import Unauthorized
 from ZODB.POSException import ConflictError
@@ -167,8 +168,10 @@
 
     def __call__(self, published, REQUEST, t, v, traceback):
         try:
+            t, v = upgradeException(t, v)
+
             if t is SystemExit or issubclass(t, Redirect):
-                raise
+                raise t, v, traceback
 
             if issubclass(t, ConflictError):
                 self.logConflicts(v, REQUEST)

Modified: Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py
===================================================================
--- Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py 2009-07-14 
06:33:00 UTC (rev 101881)
+++ Zope/branches/2.12/src/Zope2/App/tests/testExceptionHook.py 2009-07-14 
08:38:03 UTC (rev 101882)
@@ -115,19 +115,21 @@
 class ExceptionHookTest(ExceptionHookTestCase):
 
     def testStringException1(self):
+        from zExceptions import Unauthorized
         def f():
-            raise 'unauthorized', 'x'
+            raise 'Unauthorized', 'x'
         if sys.version_info < (2, 6):
-            self.assertRaises('unauthorized', self.call, None, None, f)
+            self.assertRaises(Unauthorized, self.call, None, None, f)
         else:
             # Raising a string exception causes a TypeError on Python 2.6
             self.assertRaises(TypeError, self.call, None, None, f)
 
     def testStringException2(self):
+        from zExceptions import Redirect
         def f():
-            raise 'redirect', 'x'
+            raise 'Redirect', 'x'
         if sys.version_info < (2, 6):
-            self.assertRaises('redirect', self.call, None, None, f)
+            self.assertRaises(Redirect, self.call, None, None, f)
         else:
             # Raising a string exception causes a TypeError on Python 2.6
             self.assertRaises(TypeError, self.call, None, None, f)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to