Commit 477077de authored by Vincent Pelletier's avatar Vincent Pelletier

Instead of raising because of deprecated use, warn and fallback.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17376 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1314b1d8
...@@ -509,10 +509,6 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -509,10 +509,6 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(**kw) allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(**kw)
catalog = self.getSQLCatalog(sql_catalog_id) catalog = self.getSQLCatalog(sql_catalog_id)
method = getattr(catalog, catalog.sql_search_security, None) method = getattr(catalog, catalog.sql_search_security, None)
if method is None:
raise DeprecationWarning, "The usage of allowedRolesAndUsers is "\
"deprecated. Please update your catalog "\
"business template."
if allowedRolesAndUsers: if allowedRolesAndUsers:
allowedRolesAndUsers.sort() allowedRolesAndUsers.sort()
cache_key = tuple(allowedRolesAndUsers) cache_key = tuple(allowedRolesAndUsers)
...@@ -524,6 +520,16 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -524,6 +520,16 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
try: try:
security_uid_list = security_uid_cache[cache_key] security_uid_list = security_uid_cache[cache_key]
except KeyError: except KeyError:
if method is None:
warnings.warn("The usage of allowedRolesAndUsers is "\
"deprecated. Please update your catalog "\
"business template.", DeprecationWarning)
security_uid_list = [x.security_uid for x in \
self.unrestrictedSearchResults(
allowedRolesAndUsers=allowedRolesAndUsers,
select_expression="security_uid",
group_by_expression="security_uid")]
else:
# XXX: What with this string transformation ?! Souldn't it be done in # XXX: What with this string transformation ?! Souldn't it be done in
# dtml instead ? # dtml instead ?
allowedRolesAndUsers = ["'%s'" % (role, ) for role in allowedRolesAndUsers] allowedRolesAndUsers = ["'%s'" % (role, ) for role in allowedRolesAndUsers]
......
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