Commit fdfe9a5a authored by Vincent Pelletier's avatar Vincent Pelletier

Add an src__ parameter to WorkflowTool_listActions patch to get SQL query list...

Add an src__ parameter to WorkflowTool_listActions patch to get SQL query list instead of action list.
Remove unneeded commented-out LOG (now, source is available).
Do not use intermediate parameter dict search_result_kw now that only one call with those parameters remains.
Note: SQL used to refresh worklist cache table is not inclued in this change.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18880 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5b12434d
...@@ -446,7 +446,7 @@ def generateActionList(worklist_metadata, worklist_result, portal_url): ...@@ -446,7 +446,7 @@ def generateActionList(worklist_metadata, worklist_result, portal_url):
'category': metadata['action_box_category']}) 'category': metadata['action_box_category']})
return action_list return action_list
def WorkflowTool_listActions(self, info=None, object=None): def WorkflowTool_listActions(self, info=None, object=None, src__=False):
""" """
Returns a list of actions to be displayed to the user. Returns a list of actions to be displayed to the user.
...@@ -512,6 +512,8 @@ def WorkflowTool_listActions(self, info=None, object=None): ...@@ -512,6 +512,8 @@ def WorkflowTool_listActions(self, info=None, object=None):
acceptable_key_dict=acceptable_key_dict, acceptable_key_dict=acceptable_key_dict,
getSecurityUidListAndRoleColumnDict=\ getSecurityUidListAndRoleColumnDict=\
getSecurityUidListAndRoleColumnDict) getSecurityUidListAndRoleColumnDict)
if src__:
action_list = []
for grouped_worklist_dict in worklist_list_grouped_by_condition: for grouped_worklist_dict in worklist_list_grouped_by_condition:
# Generate the query for this worklist_list # Generate the query for this worklist_list
(total_criterion_id_list, query) = \ (total_criterion_id_list, query) = \
...@@ -519,17 +521,19 @@ def WorkflowTool_listActions(self, info=None, object=None): ...@@ -519,17 +521,19 @@ def WorkflowTool_listActions(self, info=None, object=None):
group_by_expression = ', '.join(total_criterion_id_list) group_by_expression = ', '.join(total_criterion_id_list)
assert COUNT_COLUMN_TITLE not in total_criterion_id_list assert COUNT_COLUMN_TITLE not in total_criterion_id_list
select_expression = select_expression_prefix + group_by_expression select_expression = select_expression_prefix + group_by_expression
search_result_kw = {'select_expression': select_expression, catalog_brain_result = search_result(select_expression=select_expression,
'group_by_expression': group_by_expression, group_by_expression=group_by_expression,
'query': query} query=query,
#LOG('WorklistGeneration', WARNING, 'Using query: %s' % \ src__=src__)
# (search_result(src__=1, **search_result_kw), )) if src__:
catalog_brain_result = search_result(**search_result_kw) action_list.append(catalog_brain_result)
else:
grouped_worklist_result = sumCatalogResultByWorklist( grouped_worklist_result = sumCatalogResultByWorklist(
grouped_worklist_dict=grouped_worklist_dict, grouped_worklist_dict=grouped_worklist_dict,
catalog_result=catalog_brain_result) catalog_result=catalog_brain_result)
for key, value in grouped_worklist_result.iteritems(): for key, value in grouped_worklist_result.iteritems():
worklist_result_dict[key] = value + worklist_result_dict.get(key, 0) worklist_result_dict[key] = value + worklist_result_dict.get(key, 0)
if not src__:
action_list = generateActionList(worklist_metadata=worklist_metadata, action_list = generateActionList(worklist_metadata=worklist_metadata,
worklist_result=worklist_result_dict, worklist_result=worklist_result_dict,
portal_url=portal_url) portal_url=portal_url)
...@@ -540,6 +544,9 @@ def WorkflowTool_listActions(self, info=None, object=None): ...@@ -540,6 +544,9 @@ def WorkflowTool_listActions(self, info=None, object=None):
action_list.sort(action_cmp) action_list.sort(action_cmp)
return action_list return action_list
user = str(_getAuthenticatedUser(self)) user = str(_getAuthenticatedUser(self))
if src__:
actions = _getWorklistActionList()
else:
_getWorklistActionList = CachingMethod(_getWorklistActionList, _getWorklistActionList = CachingMethod(_getWorklistActionList,
id=('_getWorklistActionList', user, portal_url), id=('_getWorklistActionList', user, portal_url),
cache_factory = 'erp5_ui_short') cache_factory = 'erp5_ui_short')
......
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