Commit 780a3726 authored by Hanno Schlichting's avatar Hanno Schlichting

Merged c101882 from 2.12 branch

parent c07f53d0
......@@ -23,6 +23,7 @@ from Acquisition import aq_parent
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 @@ class ZPublisherExceptionHook:
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)
......
......@@ -115,19 +115,21 @@ class ExceptionHookTestCase(unittest.TestCase):
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment