[Erp5-report] r37425 yo - /erp5/trunk/products/ERP5/Document/Predicate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Aug 3 09:36:22 CEST 2010


Author: yo
Date: Tue Aug  3 09:36:18 2010
New Revision: 37425

URL: http://svn.erp5.org?rev=37425&view=rev
Log:
Stop rewriting _identity_criterion and _range_criterion unnecessarily. This caused a lot of conflicts only by viewing objects.

Modified:
    erp5/trunk/products/ERP5/Document/Predicate.py

Modified: erp5/trunk/products/ERP5/Document/Predicate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Predicate.py?rev=37425&r1=37424&r2=37425&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Predicate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Predicate.py [utf8] Tue Aug  3 09:36:18 2010
@@ -543,8 +543,21 @@ class Predicate(XMLObject):
           new_membership_criterion_base_category_list.append(base_category)
 
     new_criterion_property_list =  list(self.getCriterionPropertyList())
-    identity_criterion = getattr(self,'_identity_criterion',{})
-    range_criterion = getattr(self,'_range_criterion',{})
+
+    # We need to build new criteria for asContext, and we should not
+    # modify the original, so we always make copies. Since the usage is
+    # temporary, use dicts instead of persistent mappings.
+    identity_criterion = getattr(self, '_identity_criterion', None)
+    if identity_criterion is None:
+      identity_criterion = {}
+    else:
+      identity_criterion = dict(identity_criterion)
+    range_criterion = getattr(self, '_range_criterion', None)
+    if range_criterion is None:
+      range_criterion = {}
+    else:
+      range_criterion = dict(range_criterion)
+
     # Look at local properties and make it criterion properties
     for property in criterion_property_list:
       if property not in self.getCriterionPropertyList() \




More information about the Erp5-report mailing list