Skip to content

Commit

Permalink
- Launchpad #257269: 'raise SystemExit' with a PythonScript could shu…
Browse files Browse the repository at this point in the history
…tdown

  a complete Zope instance
  • Loading branch information
zopyx committed Aug 12, 2008
1 parent 4cfdb10 commit 16045d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PythonScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ def _exec(self, bound_names, args, kw):
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)
Expand Down
5 changes: 5 additions & 0 deletions tests/testPythonScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ def testDateTime(self):
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):

Expand Down

0 comments on commit 16045d6

Please sign in to comment.