From 8b60ddfea921f32e5c65b575adad157fd56ac1b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 26 Jun 2007 10:13:38 +0000
Subject: [PATCH] add compatibility with script that takes no argument

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14975 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Predicate.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/Predicate.py b/product/ERP5/Document/Predicate.py
index 06ba560af1..e2687dac4f 100644
--- a/product/ERP5/Document/Predicate.py
+++ b/product/ERP5/Document/Predicate.py
@@ -162,7 +162,11 @@ class Predicate(XMLObject, Folder):
       for test_method_id in test_method_id_list :
         if (test_method_id is not None) and result:
           method = getattr(context,test_method_id)
-          result = result and method(self)
+          try:
+            result = result and method(self)
+          except TypeError:
+            # backward compatibilty with script that takes no argument
+            result = result and method()
 #        LOG('predicate test', 0,
 #            '%s after method %s ' % (result, test_method_id))
     return result
-- 
2.30.9