Commit c0001378 authored by Vincent Pelletier's avatar Vincent Pelletier

Add support for future Query API, which resolves related keys internaly, thus...

Add support for future Query API, which resolves related keys internaly, thus removing the need for manual mapping here.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25093 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 604eb7fc
...@@ -482,6 +482,16 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -482,6 +482,16 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
# Generate the query for this worklist_list # Generate the query for this worklist_list
(total_criterion_id_list, query) = \ (total_criterion_id_list, query) = \
getWorklistListQuery(grouped_worklist_dict=grouped_worklist_dict) getWorklistListQuery(grouped_worklist_dict=grouped_worklist_dict)
group_by_expression = ', '.join(total_criterion_id_list)
assert COUNT_COLUMN_TITLE not in total_criterion_id_list
getRelatedTableMapDict = getattr(query, 'getRelatedTableMapDict', None)
if getRelatedTableMapDict is None:
# If required mapping method is not present on the query, assume it
# handles column mapping properly, and build a bare select
# expression.
select_expression = select_expression_prefix + ', ' \
+ group_by_expression
else:
# We must compute alias names ourselves because we need to know them # We must compute alias names ourselves because we need to know them
# in order to compute 'select_expression'. # in order to compute 'select_expression'.
related_table_map_dict = query.getRelatedTableMapDict() related_table_map_dict = query.getRelatedTableMapDict()
...@@ -509,8 +519,6 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -509,8 +519,6 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
select_expression.append('%s.%s as %s' select_expression.append('%s.%s as %s'
% (table_id, column_id, criterion_id)) % (table_id, column_id, criterion_id))
query.getRelatedTableMapDict = lambda: related_table_map_dict query.getRelatedTableMapDict = lambda: related_table_map_dict
group_by_expression = ', '.join(total_criterion_id_list)
assert COUNT_COLUMN_TITLE not in total_criterion_id_list
select_expression = ', '.join(select_expression) select_expression = ', '.join(select_expression)
try: try:
catalog_brain_result = search_result( catalog_brain_result = search_result(
......
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