Commit 3753d1a2 authored by Andreas Jung's avatar Andreas Jung

- Launchpad #257269: 'raise SystemExit' with a PythonScript could shutdown

  a complete Zope instance
parent c980fe1b
...@@ -204,6 +204,9 @@ Zope Changes ...@@ -204,6 +204,9 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Launchpad #257269: 'raise SystemExit' with a PythonScript could shutdown
a complete Zope instance
- DateTime conversion of datetime objects with non-pytz tzinfo. - DateTime conversion of datetime objects with non-pytz tzinfo.
Timezones() returns a copy of the timezone list (allows tests to run). Timezones() returns a copy of the timezone list (allows tests to run).
......
...@@ -322,7 +322,11 @@ class PythonScript(Script, Historical, Cacheable): ...@@ -322,7 +322,11 @@ class PythonScript(Script, Historical, Cacheable):
g['__file__'] = getattr(self, '_filepath', None) or self.get_filepath() g['__file__'] = getattr(self, '_filepath', None) or self.get_filepath()
f = new.function(fcode, g, None, fadefs) f = new.function(fcode, g, None, fadefs)
try:
result = f(*args, **kw) result = f(*args, **kw)
except SystemExit:
raise ValueError('SystemExit can not raised with a PythonScript')
if keyset is not None: if keyset is not None:
# Store the result in the cache. # Store the result in the cache.
self.ZCacheable_set(result, keywords=keyset) self.ZCacheable_set(result, keywords=keyset)
......
...@@ -222,6 +222,11 @@ class TestPythonScriptNoAq(PythonScriptTestBase): ...@@ -222,6 +222,11 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
res = self._newPS("return DateTime('2007/12/10').strftime('%d.%m.%Y')")() res = self._newPS("return DateTime('2007/12/10').strftime('%d.%m.%Y')")()
self.assertEqual(res, '10.12.2007') self.assertEqual(res, '10.12.2007')
def testRaiseSystemExitLaunchpad257269(self):
ps = self._newPS("raise SystemExit")
self.assertRaises(ValueError, ps)
class TestPythonScriptErrors(PythonScriptTestBase): class TestPythonScriptErrors(PythonScriptTestBase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment