Commit a885aba2 authored by Ayush Tiwari's avatar Ayush Tiwari

multiple_catalog: getSQLCatalog should give the catalog from preference

And, comment out the part where we try to get the acl_user in preference tool.
It is completely unncessary \review needed
parent 437a197e
...@@ -155,6 +155,11 @@ class ERP5CatalogTool(BaseTool, CMFCore_CatalogTool): ...@@ -155,6 +155,11 @@ class ERP5CatalogTool(BaseTool, CMFCore_CatalogTool):
Get current ERP5 Catalog Get current ERP5 Catalog
""" """
if id is None: if id is None:
# Better to get preferred catalog and use it is as the default catalog
# instead of getting default catalog from properties
catalog_path = self.portal_preferences.getPreferredCatalog()
catalog = self.unrestrictedTraverse(catalog_path)
return catalog
if not self.default_erp5_catalog_id: if not self.default_erp5_catalog_id:
id_list = self.getERP5CatalogIdList() id_list = self.getERP5CatalogIdList()
if len(id_list) > 0: if len(id_list) > 0:
......
...@@ -149,10 +149,10 @@ class PreferenceTool(BaseTool): ...@@ -149,10 +149,10 @@ class PreferenceTool(BaseTool):
# reset a security manager without any proxy role or unrestricted method, # reset a security manager without any proxy role or unrestricted method,
# wich affects the catalog search that we do to find applicable # wich affects the catalog search that we do to find applicable
# preferences. # preferences.
actual_user = acl_users.getUserById(user.getId()) #actual_user = acl_users.getUser(str(user))
if actual_user is not None: #if actual_user is not None:
newSecurityManager(None, actual_user.__of__(acl_users)) # newSecurityManager(None, actual_user.__of__(acl_users))
tv_key = 'PreferenceTool._getSortedPreferenceList/%s/%s' % (user.getId(), tv_key = 'PreferenceTool._getSortedPreferenceList/%s/%s' % (user,
sql_catalog_id) sql_catalog_id)
if tv.get(tv_key, None) is None: if tv.get(tv_key, None) is None:
prefs = [] prefs = []
......
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