Commit 686d59c3 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

patches/ExternalMethod update patch for Zope4

In the changes from ExternalMethod 2.13.1 -> 4.5, now ExternalMethod
define __code__ (and __defaults__) to a computed attribute calling
getFunction, but getFunction is different in our patched class, so
when unwrapMethod tries to get __code__, it will raise and mapply
will not consider the external method as being callable, so a simple
__repr__ of the ExternalMethod will be used as response body when
published.

By defining __code__ to something using our patched logic, this
problem does not happen.
parent 4cc2d557
...@@ -69,10 +69,11 @@ class _(PatchClass(ExternalMethod)): ...@@ -69,10 +69,11 @@ class _(PatchClass(ExternalMethod)):
last_read = None last_read = None
path = getPath('Extensions', self._module, path = getPath('Extensions', self._module,
suffixes=('', 'py', 'pyc')) suffixes=('', 'py', 'pyc'))
ts = os.stat(path)[stat.ST_MTIME] if path:
if last_read != ts: ts = os.stat(path)[stat.ST_MTIME]
self._v_fs = ts, path if last_read != ts:
reload = True self._v_fs = ts, path
reload = True
f = getObject(self._module, self._function, reload) f = getObject(self._module, self._function, reload)
else: else:
f = getattr(component_module, self._function) f = getattr(component_module, self._function)
......
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