Commit 4433ba0d authored by Vincent Pelletier's avatar Vincent Pelletier

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
parent 477077de
...@@ -547,39 +547,22 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -547,39 +547,22 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
catalogued with columns. catalogued with columns.
""" """
original_query = query original_query = query
try: security_uid_list, role_column_dict = self.getSecurityUidListAndRoleColumnDict(sql_catalog_id=sql_catalog_id, **kw)
security_uid_list, role_column_dict = self.getSecurityUidListAndRoleColumnDict(sql_catalog_id=sql_catalog_id, **kw) if role_column_dict:
except DeprecationWarning, message: query_list = []
warnings.warn(message, DeprecationWarning) for key, value in role_column_dict.items():
allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(sql_catalog_id=sql_catalog_id, **kw) new_query = Query(**{key : value})
if role_column_dict: query_list.append(new_query)
query_list = [] operator_kw = {'operator': 'AND'}
for key, value in role_column_dict.items(): query = ComplexQuery(*query_list, **operator_kw)
new_query = Query(**{key : value}) # If security_uid_list is empty, adding it to criterions will only
query_list.append(new_query) # result in "false or [...]", so avoid useless overhead by not
operator_kw = {'operator': 'AND'} # adding it at all.
query = ComplexQuery(*query_list, **operator_kw) if security_uid_list:
if allowedRolesAndUsers: query = ComplexQuery(Query(security_uid=security_uid_list, operator='IN'),
query = ComplexQuery(Query(allowedRolesAndUsers=allowedRolesAndUsers), query, operator='OR')
query, operator='OR')
else:
query = Query(allowedRolesAndUsers=allowedRolesAndUsers)
else: else:
if role_column_dict: query = Query(security_uid=security_uid_list, operator='IN')
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')
if original_query is not None: if original_query is not None:
query = ComplexQuery(query, original_query, operator='AND') query = ComplexQuery(query, original_query, operator='AND')
return query return query
......
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