[Zope-Checkins] SVN: Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/ - Raising a string exception generates a TypeError on Python
Sidnei da Silva
sidnei at enfoldsystems.com
Wed Oct 8 02:58:04 EDT 2008
Log message for revision 91896:
- Raising a string exception generates a TypeError on Python
2.6. Adjust tests accordingly.
Changed:
U Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/startup.py
U Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/tests/testExceptionHook.py
-=-
Modified: Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/startup.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/startup.py 2008-10-08 06:50:37 UTC (rev 91895)
+++ Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/startup.py 2008-10-08 06:58:04 UTC (rev 91896)
@@ -207,8 +207,9 @@
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
Modified: Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/tests/testExceptionHook.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/tests/testExceptionHook.py 2008-10-08 06:50:37 UTC (rev 91895)
+++ Zope/branches/gsoc-python-2.5/lib/python/Zope2/App/tests/testExceptionHook.py 2008-10-08 06:58:04 UTC (rev 91896)
@@ -118,12 +118,20 @@
def testStringException1(self):
def f():
raise 'unauthorized', 'x'
- self.assertRaises('unauthorized', self.call, None, None, f)
+ 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'
- self.assertRaises('redirect', self.call, None, None, f)
+ 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():
More information about the Zope-Checkins
mailing list