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
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).
......
......@@ -322,7 +322,11 @@ class PythonScript(Script, Historical, Cacheable):
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)
......
......@@ -222,6 +222,11 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
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):
......
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