Commit 12228d92 authored by Vincent Pelletier's avatar Vincent Pelletier

Transmit bare column values instead of pre-formated ones to allow accessing them from python code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15848 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4e4b5d1e
...@@ -358,6 +358,9 @@ class SimulationTool(BaseTool): ...@@ -358,6 +358,9 @@ class SimulationTool(BaseTool):
group_by = new_kw.pop('group_by', []) group_by = new_kw.pop('group_by', [])
if len(group_by): if len(group_by):
new_kw['group_by_expression'] = ', '.join(['%s.%s' % (table, x) for x in group_by]) new_kw['group_by_expression'] = ', '.join(['%s.%s' % (table, x) for x in group_by])
column_value_dict = new_kw.pop('column_value_dict', {})
for key, value in column_value_dict.iteritems():
new_kw['%s.%s' % (table, key)] = value
sql_kw.update(self.portal_catalog.buildSQLQuery(**new_kw)) sql_kw.update(self.portal_catalog.buildSQLQuery(**new_kw))
return sql_kw return sql_kw
...@@ -449,48 +452,51 @@ class SimulationTool(BaseTool): ...@@ -449,48 +452,51 @@ class SimulationTool(BaseTool):
operator='AND')) operator='AND'))
# Some columns exists on multiple tables, we have to clear ambiguities # Some columns exists on multiple tables, we have to clear ambiguities
column_value_dict = {}
if resource_uid is not None : if resource_uid is not None :
new_kw[table + '.resource_uid'] = resource_uid column_value_dict['resource_uid'] = resource_uid
if section_uid is not None : if section_uid is not None :
new_kw[table + '.section_uid'] = section_uid column_value_dict['section_uid'] = section_uid
sql_kw['section_filtered'] = 1 sql_kw['section_filtered'] = 1
if node_uid is not None : if node_uid is not None :
new_kw[table + '.node_uid'] = node_uid column_value_dict['node_uid'] = node_uid
resource_uid_list = self._generatePropertyUidList(resource) resource_uid_list = self._generatePropertyUidList(resource)
if resource_uid_list: if resource_uid_list:
new_kw[table + '.resource_uid'] = resource_uid_list column_value_dict['resource_uid'] = resource_uid_list
item_uid_list = self._generatePropertyUidList(item) item_uid_list = self._generatePropertyUidList(item)
if item_uid_list: if item_uid_list:
new_kw[table + '.aggregate_uid'] = item_uid_list column_value_dict['aggregate_uid'] = item_uid_list
node_uid_list = self._generatePropertyUidList(node) node_uid_list = self._generatePropertyUidList(node)
if node_uid_list: if node_uid_list:
new_kw[table + '.node_uid'] = node_uid_list column_value_dict['node_uid'] = node_uid_list
payment_uid_list = self._generatePropertyUidList(payment) payment_uid_list = self._generatePropertyUidList(payment)
if payment_uid_list: if payment_uid_list:
new_kw[table + '.payment_uid'] = payment_uid_list column_value_dict['payment_uid'] = payment_uid_list
section_uid_list = self._generatePropertyUidList(section) section_uid_list = self._generatePropertyUidList(section)
if section_uid_list: if section_uid_list:
new_kw[table + '.section_uid'] = section_uid_list column_value_dict['section_uid'] = section_uid_list
sql_kw['section_filtered'] = 1 sql_kw['section_filtered'] = 1
mirror_section_uid_list = self._generatePropertyUidList(mirror_section) mirror_section_uid_list = self._generatePropertyUidList(mirror_section)
if mirror_section_uid_list: if mirror_section_uid_list:
new_kw[table + '.mirror_section_uid'] = mirror_section_uid_list column_value_dict['mirror_section_uid'] = mirror_section_uid_list
variation_text_list = self._generatePropertyUidList(variation_text, variation_text_list = self._generatePropertyUidList(variation_text,
as_text=1) as_text=1)
if variation_text_list: if variation_text_list:
new_kw[table + '.variation_text'] = variation_text_list column_value_dict['variation_text'] = variation_text_list
sub_variation_text_list = self._generatePropertyUidList( sub_variation_text_list = self._generatePropertyUidList(
sub_variation_text, as_text=1) sub_variation_text, as_text=1)
if sub_variation_text_list: if sub_variation_text_list:
new_kw[table + '.sub_variation_text'] = sub_variation_text_list column_value_dict['sub_variation_text'] = sub_variation_text_list
new_kw['column_value_dict'] = column_value_dict
# category membership # category membership
resource_category_uid_list = self._generatePropertyUidList( resource_category_uid_list = self._generatePropertyUidList(
......
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