Commit dc2bab95 authored by Vincent Pelletier's avatar Vincent Pelletier

Folder_generateWorkflowReport: Use select_dict to alias select function

parent 827dc5dc
...@@ -27,15 +27,14 @@ for portal_type in context.allowedContentTypes(): ...@@ -27,15 +27,14 @@ for portal_type in context.allowedContentTypes():
state_count_dict[state_id] = 0 state_count_dict[state_id] = 0
add(state_var) add(state_var)
column_list = ['portal_type'] + list(state_variable_set) column_list = ['portal_type'] + list(state_variable_set)
COUNT = 'count(*)'
search_folder_kw = {} search_folder_kw = {}
if use_selection: if use_selection:
selection_kw = portal.portal_selections.getSelectionParamsFor(selection_name).copy() selection_kw = portal.portal_selections.getSelectionParamsFor(selection_name).copy()
selection_kw.pop('limit', None) selection_kw.pop('limit', None)
search_folder_kw['query'] = portal.portal_catalog.getSQLCatalog().buildQuery(selection_kw) search_folder_kw['query'] = portal.portal_catalog.getSQLCatalog().buildQuery(selection_kw)
for line in context.searchFolder(group_by=column_list, select_list=[COUNT] + column_list, **search_folder_kw): for line in context.searchFolder(group_by=column_list, select_dict={'count': 'count(*)'} + column_list, **search_folder_kw):
portal_type = line.portal_type portal_type = line.portal_type
count = getattr(line, COUNT) count = line.count
for state_variable in state_variable_set: for state_variable in state_variable_set:
workflow = type_state_variable_workflow_dict.get((line.portal_type, state_variable)) workflow = type_state_variable_workflow_dict.get((line.portal_type, state_variable))
state = getattr(line, state_variable) state = getattr(line, state_variable)
......
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