Commit 1bf56d7d authored by Julien Muchembled's avatar Julien Muchembled

Fix Guards on PythonScript when rendered with namespace

This fixes a regression in commit b9c41350
parent b6be9c26
...@@ -176,11 +176,17 @@ class _(PatchClass(PythonScript)): ...@@ -176,11 +176,17 @@ class _(PatchClass(PythonScript)):
def __call__(self, *args, **kw): def __call__(self, *args, **kw):
'''Calls the script.''' '''Calls the script.'''
self.checkGuard(True) # patch self.checkGuard(True) # patch
return self._bindAndExec(args, kw, None) return self._orig_bindAndExec(args, kw, None)
security.declarePublic("render") security.declarePublic("render")
render = __call__ render = __call__
# For __render_with_namespace__ (we prefer to monkey-patch __call__
# because it's called more often, and this makes debugging easier)
_orig_bindAndExec = PythonScript._bindAndExec
def _bindAndExec(self, args, kw, caller_namespace):
return self(*args, **kw) # caller_namespace not used by PythonScript
addGuard(PythonScript, 'Change Python Scripts') addGuard(PythonScript, 'Change Python Scripts')
InitializeClass(PythonScript) InitializeClass(PythonScript)
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