diff --git a/product/ERP5/Document/Predicate.py b/product/ERP5/Document/Predicate.py index f13de610fb009201aa4d677ecaaa3ca2870759de..ba68b5243baa10f836281063af19663f70c166e7 100644 --- a/product/ERP5/Document/Predicate.py +++ b/product/ERP5/Document/Predicate.py @@ -27,6 +27,7 @@ # ############################################################################## +from types import MethodType import zope.interface from warnings import warn from AccessControl import ClassSecurityInfo @@ -187,7 +188,7 @@ class Predicate(XMLObject): try: result = result and method(self) except TypeError: - if method.func_code.co_argcount != 0: + if method.func_code.co_argcount != isinstance(method, MethodType): raise # backward compatibilty with script that takes no argument warn('Predicate %s uses an old-style method (%s) that does not' diff --git a/product/ERP5Type/Accessor/Constant.py b/product/ERP5Type/Accessor/Constant.py index 924be35203691efeffc8530137f4fea304494da7..745def871db8472b0f098a9cb96e7ce21d80cfba 100644 --- a/product/ERP5Type/Accessor/Constant.py +++ b/product/ERP5Type/Accessor/Constant.py @@ -38,6 +38,10 @@ class PropertyGetter: issues when we wish to make a property a method. For instance, we would like to change from isIndexable=1 to a method isIndexable(). """ + func_code = func_code() + func_code.co_varnames = () + func_code.co_argcount = 0 + func_defaults = () def __init__(self, id, value=None): self._id = id