[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PythonScripts/ fixed integration of Hotfix-2008-08-08
Andreas Jung
andreas at andreas-jung.com
Thu Aug 14 12:14:01 EDT 2008
Log message for revision 89839:
fixed integration of Hotfix-2008-08-08
Changed:
U Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py
-=-
Modified: Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:11:50 UTC (rev 89838)
+++ Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:14:00 UTC (rev 89839)
@@ -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.10/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:11:50 UTC (rev 89838)
+++ Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:14:00 UTC (rev 89839)
@@ -211,7 +211,15 @@
f = self._filePS('complex_print')
self.assertEqual(f.get_size(), len(f.read()))
+ 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