[Erp5-report] r34650 jm - in /erp5/trunk/products: ERP5/Document/ ERP5Type/Accessor/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Apr 19 14:09:55 CEST 2010
Author: jm
Date: Mon Apr 19 14:09:55 2010
New Revision: 34650
URL: http://svn.erp5.org?rev=34650&view=rev
Log:
Make isDelivery/isMovement usable as predicate test method
Modified:
erp5/trunk/products/ERP5/Document/Predicate.py
erp5/trunk/products/ERP5Type/Accessor/Constant.py
Modified: erp5/trunk/products/ERP5/Document/Predicate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Predicate.py?rev=34650&r1=34649&r2=34650&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Predicate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Predicate.py [utf8] Mon Apr 19 14:09:55 2010
@@ -27,6 +27,7 @@
#
##############################################################################
+from types import MethodType
import zope.interface
from warnings import warn
from AccessControl import ClassSecurityInfo
@@ -187,7 +188,7 @@
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'
Modified: erp5/trunk/products/ERP5Type/Accessor/Constant.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/Constant.py?rev=34650&r1=34649&r2=34650&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/Constant.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Accessor/Constant.py [utf8] Mon Apr 19 14:09:55 2010
@@ -38,6 +38,10 @@
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
More information about the Erp5-report
mailing list