Commit 2fd15edd authored by Łukasz Nowak's avatar Łukasz Nowak

- static categories have precedence over dynamic ones

 - add check for value getter without list


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27661 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9c74046
......@@ -112,30 +112,32 @@ class BusinessPath(Path):
# ICategoryAccessProvider overriden methods
def _getCategoryMembershipList(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.get('context')
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,
......
......@@ -2422,6 +2422,8 @@ class TestBPMImplementation(TestBPMMixin):
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment