Commit d459676a authored by Sidnei da Silva's avatar Sidnei da Silva

- Raising a string exception generates a TypeError on Python

  2.6. Adjust tests accordingly.
parent 20418f31
......@@ -207,8 +207,9 @@ class ZPublisherExceptionHook:
else:
error_log_url = log.raising((t, v, traceback))
if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '')
!='text/html'):
if (REQUEST is None or
(getattr(REQUEST.get('RESPONSE', None), '_error_format', '')
!= 'text/html')):
raise t, v, traceback
# Lookup a view for the exception and render it, then
......
......@@ -118,12 +118,20 @@ class ExceptionHookTest(ExceptionHookTestCase):
def testStringException1(self):
def f():
raise 'unauthorized', 'x'
if sys.version_info < (2, 6):
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):
def f():
raise 'redirect', 'x'
if sys.version_info < (2, 6):
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)
def testSystemExit(self):
def 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