[Erp5-report] r44436 seb - /erp5/trunk/products/ERP5/ExplanationCache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 18 17:21:03 CET 2011


Author: seb
Date: Fri Mar 18 17:21:03 2011
New Revision: 44436

URL: http://svn.erp5.org?rev=44436&view=rev
Log:
* the usage of explanation_uid is not always appropriate. If
  we want to change it, we might change getExplanationValue method
  on simulation movements
* in getBusinessLinkClosure, hasMatchingMovement was not
  finding enough simulation movements because the catalog was
  not looking for sub objects in the simulation

Modified:
    erp5/trunk/products/ERP5/ExplanationCache.py

Modified: erp5/trunk/products/ERP5/ExplanationCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ExplanationCache.py?rev=44436&r1=44435&r2=44436&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ExplanationCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ExplanationCache.py [utf8] Fri Mar 18 17:21:03 2011
@@ -202,8 +202,16 @@ class ExplanationCache:
         # all simulation movements from a site
         if kw.get('path', None) is None:
           kw['path'] = self.getSimulationPathPatternList() # XXX-JPS Explicit Query is better
-        if kw.get('explanation_uid', None) is None:
-          kw['explanation_uid'] = self.getRootExplanationUidList()
+        # XXX-Seb It seems incompatible with the way explanation is working
+        # Indeed, the explanation is not the same all other the simulation tree
+        #      path                explanation
+        # portal_simulation/91/1 testing_folder/17
+        # portal_simulation/91/1/1 testing_folder/17
+        # portal_simulation/91/1/1/1 testing_folder/18
+        # portal_simulation/91/1/1/1/1 testing_folder/18
+        # portal_simulation/91/1/1/1/1/1 testing_folder/17
+        #if kw.get('explanation_uid', None) is None:
+        #  kw['explanation_uid'] = self.getRootExplanationUidList()
         self.simulation_movement_cache[kw_tuple] = \
                self.portal_catalog(portal_type="Simulation Movement",
                                    **kw)
@@ -243,14 +251,16 @@ class ExplanationCache:
 
     # Build a list of path patterns which apply to current business_link
     path_list = self.getSimulationPathPatternList()
-    path_list = map(lambda x:x[0:-1], path_list) # Remove trailing %
+    path_list = [x for x in path_list if x[-1] != '%'] # Remove trailing %
     path_set = set()
     for simulation_movement in \
         self.getBusinessLinkRelatedSimulationMovementValueList(business_link):
       simulation_path = simulation_movement.getPath()
       for path in path_list:
         if simulation_path.startswith(path):
-          path_set.add(path) # Only keep a path pattern which matches current simulation movement
+          # Only keep a path pattern which matches current simulation movement
+          path_set.add(path)
+          path_set.add("%s/%%" % path)
 
     # Lookup in cache based on path_tuple
     path_tuple = tuple(path_set) # XXX-JPS is the order guaranteed here ?



More information about the Erp5-report mailing list