From 4433ba0d3fda70788fc8df81f5bf665799cba8e8 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 2 Nov 2007 18:25:21 +0000 Subject: [PATCH] Remove fallback code: getSecurityUidListAndRoleColumnDict do not raise DeprecationWarning anymore. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17377 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Catalog/CatalogTool.py | 47 ++++++++++-------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/product/ERP5Catalog/CatalogTool.py b/product/ERP5Catalog/CatalogTool.py index a039bfbf04..23a0c94c0d 100644 --- a/product/ERP5Catalog/CatalogTool.py +++ b/product/ERP5Catalog/CatalogTool.py @@ -547,39 +547,22 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): catalogued with columns. """ original_query = query - try: - security_uid_list, role_column_dict = self.getSecurityUidListAndRoleColumnDict(sql_catalog_id=sql_catalog_id, **kw) - except DeprecationWarning, message: - warnings.warn(message, DeprecationWarning) - allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(sql_catalog_id=sql_catalog_id, **kw) - if role_column_dict: - query_list = [] - for key, value in role_column_dict.items(): - new_query = Query(**{key : value}) - query_list.append(new_query) - operator_kw = {'operator': 'AND'} - query = ComplexQuery(*query_list, **operator_kw) - if allowedRolesAndUsers: - query = ComplexQuery(Query(allowedRolesAndUsers=allowedRolesAndUsers), - query, operator='OR') - else: - query = Query(allowedRolesAndUsers=allowedRolesAndUsers) + security_uid_list, role_column_dict = self.getSecurityUidListAndRoleColumnDict(sql_catalog_id=sql_catalog_id, **kw) + if role_column_dict: + query_list = [] + for key, value in role_column_dict.items(): + new_query = Query(**{key : value}) + query_list.append(new_query) + operator_kw = {'operator': 'AND'} + query = ComplexQuery(*query_list, **operator_kw) + # If security_uid_list is empty, adding it to criterions will only + # result in "false or [...]", so avoid useless overhead by not + # adding it at all. + if security_uid_list: + query = ComplexQuery(Query(security_uid=security_uid_list, operator='IN'), + query, operator='OR') else: - if role_column_dict: - query_list = [] - for key, value in role_column_dict.items(): - new_query = Query(**{key : value}) - query_list.append(new_query) - operator_kw = {'operator': 'AND'} - query = ComplexQuery(*query_list, **operator_kw) - # If security_uid_list is empty, adding it to criterions will only - # result in "false or [...]", so avoid useless overhead by not - # adding it at all. - if security_uid_list: - query = ComplexQuery(Query(security_uid=security_uid_list, operator='IN'), - query, operator='OR') - else: - query = Query(security_uid=security_uid_list, operator='IN') + query = Query(security_uid=security_uid_list, operator='IN') if original_query is not None: query = ComplexQuery(query, original_query, operator='AND') return query -- 2.30.9