From 391b2a38857728b1206d789eaaf2c46d5a77f771 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Fri, 12 Jan 2007 18:00:06 +0000 Subject: [PATCH] This adds some compatibility between old naming and new naming. It also fixed asSQLJoinExpression so that domain trees may work again. This fix is a quick hack. The appropriate approach is to refactor the querying mechanism alltogether with queries in the catalog. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12050 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Predicate.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/product/ERP5/Document/Predicate.py b/product/ERP5/Document/Predicate.py index d14931d450..f559ecd883 100644 --- a/product/ERP5/Document/Predicate.py +++ b/product/ERP5/Document/Predicate.py @@ -259,20 +259,32 @@ class Predicate(Folder): sql_query['from_table_list'] = from_table_dict.items() return sql_query + # Compatibililty SQL Sql + security.declareProtected( Permissions.AccessContentsInformation, 'buildSqlQuery' ) + buildSqlQuery = buildSQLQuery + security.declareProtected( Permissions.AccessContentsInformation, 'asSQLExpression' ) def asSQLExpression(self, strict_membership=0, table='category'): """ """ return self.buildSQLQuery(strict_membership=strict_membership, table=table)['where_expression'] + # Compatibililty SQL Sql + security.declareProtected( Permissions.AccessContentsInformation, 'asSqlExpression' ) + asSqlExpression = asSQLExpression + security.declareProtected( Permissions.AccessContentsInformation, 'asSQLJoinExpression' ) def asSQLJoinExpression(self, strict_membership=0, table='category', join_table='catalog', join_column='uid'): """ """ table_list = self.buildSQLQuery(strict_membership=strict_membership, table=table)['from_table_list'] - sql_text_list = map(lambda (a,b): '%s AS %s' % (b,a), table_list) + sql_text_list = map(lambda (a,b): '%s AS %s' % (b,a), filter(lambda (a,b): a != join_table, table_list)) return ' , '.join(sql_text_list) + # Compatibililty SQL Sql + security.declareProtected( Permissions.AccessContentsInformation, 'asSqlJoinExpression' ) + asSqlJoinExpression = asSQLJoinExpression + def searchResults(self, **kw): """ """ -- 2.30.9