Commit ff754bce authored by Jérome Perrin's avatar Jérome Perrin

trade model path patch (see comments)

parent 13757147
...@@ -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:
base_category, **kw) result[base_category] = self._filterCategoryList(dynamic_category_list,
if len(category_url_list) == 0 and len(dynamic_category_list) > 0: base_category, **kw)
category_url_list = self._filterCategoryList(dynamic_category_list, else:
base_category, **kw) category_url_list = Path._getAcquiredCategoryMembershipList(
if len(category_url_list) > 0: self, base_category, **kw)
result[base_category] = category_url_list 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)
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
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