[Zope-Checkins] SVN: Zope/branches/2.11/lib/python/Products/PythonScripts/ fixed integration of Hotfix-2008-08-12
Andreas Jung
andreas at andreas-jung.com
Thu Aug 14 12:11:50 EDT 2008
Log message for revision 89838:
fixed integration of Hotfix-2008-08-12
Changed:
U Zope/branches/2.11/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/2.11/lib/python/Products/PythonScripts/tests/testPythonScript.py
-=-
Modified: Zope/branches/2.11/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.11/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 15:57:30 UTC (rev 89837)
+++ Zope/branches/2.11/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:11:50 UTC (rev 89838)
@@ -324,7 +324,11 @@
g['__file__'] = getattr(self, '_filepath', None) or self.get_filepath()
f = new.function(fcode, g, None, fadefs)
- result = f(*args, **kw)
+ try:
+ result = f(*args, **kw)
+ except SystemExit:
+ raise ValueError('SystemExit can not be raised within a PythonScript')
+
if keyset is not None:
# Store the result in the cache.
self.ZCacheable_set(result, keywords=keyset)
Modified: Zope/branches/2.11/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.11/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 15:57:30 UTC (rev 89837)
+++ Zope/branches/2.11/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:11:50 UTC (rev 89838)
@@ -222,7 +222,15 @@
res = self._newPS("return DateTime('2007/12/10').strftime('%d.%m.%Y')")()
self.assertEqual(res, '10.12.2007')
+ def testRaiseSystemExitLaunchpad257269(self):
+ ps = self._newPS("raise SystemExit")
+ self.assertRaises(ValueError, ps)
+ def testEncodingTestDotTestAllLaunchpad257276(self):
+ ps = self._newPS("return 'foo'.encode('test.testall')")
+ self.assertRaises(LookupError, ps)
+
+
class TestPythonScriptErrors(PythonScriptTestBase):
def assertPSRaises(self, error, path=None, body=None):
More information about the Zope-Checkins
mailing list