[Erp5-report] r27661 - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 18 17:08:50 CEST 2009


Author: luke
Date: Thu Jun 18 17:08:48 2009
New Revision: 27661

URL: http://svn.erp5.org?rev=27661&view=rev
Log:
 - static categories have precedence over dynamic ones
 - add check for value getter without list

Modified:
    erp5/trunk/products/ERP5/Document/BusinessPath.py
    erp5/trunk/products/ERP5/tests/testBPMCore.py

Modified: erp5/trunk/products/ERP5/Document/BusinessPath.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessPath.py?rev=27661&r1=27660&r2=27661&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] Thu Jun 18 17:08:48 2009
@@ -112,30 +112,32 @@
   # ICategoryAccessProvider overriden methods
   def _getCategoryMembershipList(self, category, **kw):
     """
-      Overriden in order to take into account dynamic arrow
-      categories
-    """
-    context = kw.get('context')
+      Overridden in order to take into account dynamic arrow categories in case if no static
+      categories are set on Business Path
+    """
+    context = kw.pop('context')
     result = Path._getCategoryMembershipList(self, category, **kw)
+    if len(result) > 0:
+      return result
     if context is not None:
       dynamic_category_list = self._getDynamicCategoryList(context)
-      dynamic_category_list= self._filterCategoryList(dynamic_category_list, category, **kw)
-      # TODO: static categories should have priority over dynamic categories
-      result = dynamic_category_list + result
+      dynamic_category_list = self._filterCategoryList(dynamic_category_list, category, **kw)
+      result = dynamic_category_list
     return result
 
   def _getAcquiredCategoryMembershipList(self, category, **kw):
     """
-      Overriden in order to take into account dynamic arrow
-      categories
+      Overridden in order to take into account dynamic arrow categories in case if no static
+      categories are set on Business Path
     """
     context = kw.pop('context', None)
     result = Path._getAcquiredCategoryMembershipList(self, category, **kw)
+    if len(result) > 0:
+      return result
     if context is not None:
       dynamic_category_list = self._getDynamicCategoryList(context)
-      dynamic_category_list= self._filterCategoryList(dynamic_category_list, category, **kw)
-      # TODO: static categories should have priority over dynamic categories
-      result = dynamic_category_list + result
+      dynamic_category_list = self._filterCategoryList(dynamic_category_list, category, **kw)
+      result = dynamic_category_list
     return result
 
   def _filterCategoryList(self, category_list, category, spec=(), filter=None, portal_type=(), base=0, 

Modified: erp5/trunk/products/ERP5/tests/testBPMCore.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBPMCore.py?rev=27661&r1=27660&r2=27661&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBPMCore.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBPMCore.py [utf8] Thu Jun 18 17:08:48 2009
@@ -2422,6 +2422,8 @@
     context_movement = self.createMovement()
     context_movement.setSourceValue(movement_node)
     self.assertEquals(path_node, business_path.getSourceValue())
+    self.assertEquals(path_node,
+                      business_path.getSourceValue(context=context_movement))
     self.assertEquals([path_node],
                       business_path.getSourceValueList(context=context_movement))
 




More information about the Erp5-report mailing list