[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/ fixed Hotfix-2008-08-12 integration
Andreas Jung
andreas at andreas-jung.com
Thu Aug 14 13:03:33 EDT 2008
Log message for revision 89842:
fixed Hotfix-2008-08-12 integration
Changed:
U Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/tests/testPythonScript.py
-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 16:40:49 UTC (rev 89841)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/PythonScript.py 2008-08-14 17:03:32 UTC (rev 89842)
@@ -321,7 +321,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/Zope-2_8-branch/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 16:40:49 UTC (rev 89841)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-14 17:03:32 UTC (rev 89842)
@@ -205,7 +205,16 @@
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