Log message for revision 89723: - Launchpad #257269: 'raise SystemExit' with a PythonScript could shutdown a complete Zope instance
Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py U Zope/trunk/lib/python/Products/PythonScripts/tests/testPythonScript.py -=- Modified: Zope/trunk/doc/CHANGES.txt =================================================================== --- Zope/trunk/doc/CHANGES.txt 2008-08-12 12:51:13 UTC (rev 89722) +++ Zope/trunk/doc/CHANGES.txt 2008-08-12 12:51:20 UTC (rev 89723) @@ -204,6 +204,9 @@ Bugs Fixed + - Launchpad #257269: 'raise SystemExit' with a PythonScript could shutdown + a complete Zope instance + - DateTime conversion of datetime objects with non-pytz tzinfo. Timezones() returns a copy of the timezone list (allows tests to run). Modified: Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py =================================================================== --- Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py 2008-08-12 12:51:13 UTC (rev 89722) +++ Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py 2008-08-12 12:51:20 UTC (rev 89723) @@ -322,7 +322,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 raised with a PythonScript') + if keyset is not None: # Store the result in the cache. self.ZCacheable_set(result, keywords=keyset) Modified: Zope/trunk/lib/python/Products/PythonScripts/tests/testPythonScript.py =================================================================== --- Zope/trunk/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-12 12:51:13 UTC (rev 89722) +++ Zope/trunk/lib/python/Products/PythonScripts/tests/testPythonScript.py 2008-08-12 12:51:20 UTC (rev 89723) @@ -222,7 +222,12 @@ 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) + + class TestPythonScriptErrors(PythonScriptTestBase): def assertPSRaises(self, error, path=None, body=None): _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins