Commit d0f89f1a authored by Julien Muchembled's avatar Julien Muchembled

Make isDelivery/isMovement usable as predicate test method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34650 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4837342c
......@@ -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'
......
......@@ -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
......
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