From f400b6cab7d994a07c1473acd3ca06c33e3af034 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Thu, 15 Nov 2007 18:05:37 +0000
Subject: [PATCH] if no test method is defined, the rule should not apply

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

diff --git a/product/ERP5/Document/Rule.py b/product/ERP5/Document/Rule.py
index e7ea588b3d..6a21ab0e45 100644
--- a/product/ERP5/Document/Rule.py
+++ b/product/ERP5/Document/Rule.py
@@ -119,6 +119,14 @@ class Rule(Predicate, XMLObject):
     return context.get(id)
 
   # Simulation workflow
+  def test(self, *args, **kw):
+    """
+    If no test method is defined, return False, to prevent infinite loop
+    """
+    if not self.getTestMethodId():
+      return False
+    return Predicate.test(self, *args, **kw)
+
   security.declareProtected(Permissions.ModifyPortalContent, 'expand')
   def expand(self, applied_rule, **kw):
     """
-- 
2.30.9