Commit a5b15ced authored by Jérome Perrin's avatar Jérome Perrin

rewrite the backward compatibility code to support test_method_id scripts that

does not accept an argument so that a simple TypeError in this script is
reraised properly.
Add a warning when a script not accepting this argument is called.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21560 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0449e675
......@@ -26,6 +26,7 @@
#
##############################################################################
from warnings import warn
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base, aq_inner
......@@ -177,7 +178,12 @@ class Predicate(XMLObject, Folder):
try:
result = result and method(self)
except TypeError:
if method.func_code.co_argcount != 0:
raise
# backward compatibilty with script that takes no argument
warn('Predicate %s uses an old-style method (%s) that does not'
' take the predicate as argument' % (
self.getRelativeUrl(), method.__name__), DeprecationWarning)
result = result and method()
# LOG('predicate test', 0,
# '%s after method %s ' % (result, test_method_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