Commit 5d638b5c authored by Jérome Perrin's avatar Jérome Perrin Committed by Xiaowu Zhang

trade model path patch (see comments)

parent ec582df2
...@@ -160,6 +160,11 @@ class TradeModelPath(Path): ...@@ -160,6 +160,11 @@ class TradeModelPath(Path):
) )
# XXX-JPS UNkonwn ? # XXX-JPS UNkonwn ?
# AACT Specific: in getArrowCategory, if we use a script to set categories
# dynamically, the script have to return all categories. In default
# implementation, if the script does not return a value for a given category,
# this category is taken from input movement. We don't want that, otherwise no
# way to unset a category
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getArrowCategoryDict') 'getArrowCategoryDict')
def getArrowCategoryDict(self, context=None, **kw): # XXX-JPS do we need it in API ? def getArrowCategoryDict(self, context=None, **kw): # XXX-JPS do we need it in API ?
...@@ -170,15 +175,33 @@ class TradeModelPath(Path): ...@@ -170,15 +175,33 @@ class TradeModelPath(Path):
# dynamically computed values (if not exist). # dynamically computed values (if not exist).
result = {} result = {}
dynamic_category_list = self._getDynamicCategoryList(context) dynamic_category_list = self._getDynamicCategoryList(context)
for base_category in self.getSourceArrowBaseCategoryList() +\
self.getDestinationArrowBaseCategoryList(): for base_category in self.getSourceArrowBaseCategoryList():
category_url_list = self._getAcquiredCategoryMembershipList( if self.getSourceMethodId() and context is not None:
result[base_category] = self._filterCategoryList(dynamic_category_list,
base_category, **kw)
else:
category_url_list = Path._getAcquiredCategoryMembershipList(
self, base_category, **kw)
if len(category_url_list) == 0 and context is not None:
category_url_list = self._filterCategoryList(dynamic_category_list,
base_category, **kw)
if len(category_url_list) > 0:
result[base_category] = category_url_list
for base_category in self.getDestinationArrowBaseCategoryList():
if self.getDestinationMethodId() and context is not None:
result[base_category] = self._filterCategoryList(dynamic_category_list,
base_category, **kw) base_category, **kw)
if len(category_url_list) == 0 and len(dynamic_category_list) > 0: else:
category_url_list = Path._getAcquiredCategoryMembershipList(
self, base_category, **kw)
if len(category_url_list) == 0 and context is not None:
category_url_list = self._filterCategoryList(dynamic_category_list, category_url_list = self._filterCategoryList(dynamic_category_list,
base_category, **kw) base_category, **kw)
if len(category_url_list) > 0: if len(category_url_list) > 0:
result[base_category] = category_url_list result[base_category] = category_url_list
return result return result
def _filterCategoryList(self, category_list, category, spec=(), def _filterCategoryList(self, category_list, category, spec=(),
......
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