[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/PythonScripts/ fixed integration of Hotfix-2008-08-12
Andreas Jung
andreas at andreas-jung.com
Thu Aug 14 12:16:20 EDT 2008
Log message for revision 89840:
fixed integration of Hotfix-2008-08-12
Changed:
U Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
-=-
Modified: Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:14:00 UTC (rev 89839)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:16:20 UTC (rev 89840)
@@ -323,7 +323,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.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:14:00 UTC (rev 89839)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:16:20 UTC (rev 89840)
@@ -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