Commit 5492d56a authored by Jérome Perrin's avatar Jérome Perrin

don't use low level Query.__call__ , use portal_catalog.buildSQLQuery instead

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24949 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a14f67f
......@@ -59,17 +59,12 @@
kw[\'omit_input\'] = 0\n
kw[\'omit_output\'] = 0\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
if kw.get(\'operation_date\', {}).get(\'query\'):\n
operation_date_dict = kw[\'operation_date\']\n
ss_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.start_date\':operation_date_dict[\'query\']})\n
kw[\'source_section_where_expression\'] = ss_q(datetime_search_keys=[\'delivery.start_date\'])[\'where_expression\']\n
ds_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.stop_date\':operation_date_dict[\'query\']})\n
kw[\'destination_section_where_expression\'] = ds_q(datetime_search_keys=[\'delivery.stop_date\'])[\'where_expression\']\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
kw[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': kw[\'operation_date\']})[\'where_expression\']\n
kw[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': kw[\'operation_date\']})[\'where_expression\']\n
del kw[\'operation_date\']\n
\n
return context.AccountingTransactionModule_zGetAccountingTransactionList( selection=None,\n
......@@ -118,14 +113,10 @@ return context.AccountingTransactionModule_zGetAccountingTransactionList( select
<string>kw</string>
<string>_getattr_</string>
<string>_write_</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>context</string>
<string>buildSQLQuery</string>
<string>_getitem_</string>
<string>operation_date_dict</string>
<string>_apply_</string>
<string>ss_q</string>
<string>ds_q</string>
<string>context</string>
<string>None</string>
</tuple>
</value>
......
......@@ -59,8 +59,6 @@
# Because DTML cannot do <dtml-if node or resource or...>\n
# If Python is used, it does not check the existence of a variable automatically\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
if \'node\' not in params:\n
params[\'node\'] = []\n
if \'resource\' not in params:\n
......@@ -79,18 +77,17 @@ if params.get(\'count\', 0):\n
params[\'omit_input\'] = 0\n
params[\'omit_output\'] = 0\n
\n
\n
\n
if params.get(\'operation_date\', {}).get(\'query\'):\n
operation_date_dict = params[\'operation_date\']\n
ss_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.start_date\':operation_date_dict[\'query\']})\n
params[\'source_section_where_expression\'] = ss_q(datetime_search_keys=[\'delivery.start_date\'])[\'where_expression\']\n
ds_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.stop_date\':operation_date_dict[\'query\']})\n
params[\'destination_section_where_expression\'] = ds_q(datetime_search_keys=[\'delivery.stop_date\'])[\'where_expression\']\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
params[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': params[\'operation_date\']})[\'where_expression\']\n
params[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': params[\'operation_date\']})[\'where_expression\']\n
del params[\'operation_date\']\n
\n
\n
# this method can be used to build another complex query, for example\n
# as a catalog.parent_uid filter with SimulationTool.getMovementList.\n
# In this example, you can use side independant inventory API with \n
......@@ -143,16 +140,12 @@ return context.AccountingTransactionModule_zGetAccountingTransactionList( \n
<value>
<tuple>
<string>params</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>_write_</string>
<string>_getattr_</string>
<string>context</string>
<string>buildSQLQuery</string>
<string>_getitem_</string>
<string>operation_date_dict</string>
<string>_apply_</string>
<string>ss_q</string>
<string>ds_q</string>
<string>context</string>
<string>src__</string>
<string>no_limit</string>
<string>None</string>
......
......@@ -59,18 +59,12 @@ params[\'stat\'] = 1\n
params[\'omit_input\'] = 1\n
params[\'omit_output\'] = 0\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
if params.get(\'operation_date\', {}).get(\'query\'):\n
operation_date_dict = params[\'operation_date\']\n
ss_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.start_date\':operation_date_dict[\'query\']})\n
params[\'source_section_where_expression\'] = ss_q(datetime_search_keys=[\'delivery.start_date\'])[\'where_expression\']\n
ds_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.stop_date\':operation_date_dict[\'query\']})\n
params[\'destination_section_where_expression\'] = ds_q(datetime_search_keys=[\'delivery.stop_date\'])[\'where_expression\']\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
params[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': params[\'operation_date\']})[\'where_expression\']\n
params[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': params[\'operation_date\']})[\'where_expression\']\n
del params[\'operation_date\']\n
\n
result = context.AccountingTransactionModule_zGetAccountingTransactionList(\n
......@@ -122,13 +116,9 @@ return float(\'%.02f\' % (row.total_price and - row.total_price or 0.0))\n
<string>context</string>
<string>params</string>
<string>_write_</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>buildSQLQuery</string>
<string>_getitem_</string>
<string>operation_date_dict</string>
<string>_apply_</string>
<string>ss_q</string>
<string>ds_q</string>
<string>result</string>
<string>row</string>
<string>float</string>
......
......@@ -59,18 +59,12 @@ params[\'stat\'] = 1\n
params[\'omit_output\'] = 1\n
params[\'omit_input\'] = 0\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
if params.get(\'operation_date\', {}).get(\'query\'):\n
operation_date_dict = params[\'operation_date\']\n
ss_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.start_date\':operation_date_dict[\'query\']})\n
params[\'source_section_where_expression\'] = ss_q(datetime_search_keys=[\'delivery.start_date\'])[\'where_expression\']\n
ds_q = Query(format=operation_date_dict[\'format\'],\n
type=operation_date_dict[\'type\'],\n
**{\'delivery.stop_date\':operation_date_dict[\'query\']})\n
params[\'destination_section_where_expression\'] = ds_q(datetime_search_keys=[\'delivery.stop_date\'])[\'where_expression\']\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
params[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': params[\'operation_date\']})[\'where_expression\']\n
params[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': params[\'operation_date\']})[\'where_expression\']\n
del params[\'operation_date\']\n
\n
result = context.AccountingTransactionModule_zGetAccountingTransactionList(\n
......@@ -121,13 +115,9 @@ return float(\'%.02f\' % (row.total_price or 0.0))\n
<string>context</string>
<string>params</string>
<string>_write_</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>buildSQLQuery</string>
<string>_getitem_</string>
<string>operation_date_dict</string>
<string>_apply_</string>
<string>ss_q</string>
<string>ds_q</string>
<string>result</string>
<string>row</string>
<string>float</string>
......
837
\ No newline at end of file
839
\ No newline at end of file
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