fix portlet selection; simplify options retrieval

This commit is contained in:
Helmut Merz 2024-01-03 17:33:21 +01:00
parent 64ad40fb96
commit 4635a00caf
2 changed files with 4 additions and 2 deletions

View file

@ -59,6 +59,8 @@ class PortletConfigurator(ViewConfigurator):
return getPersonForUser(self.context, self.request) return getPersonForUser(self.context, self.request)
def hasFavorites(self): def hasFavorites(self):
if 'favorites' in (self.view.globalOptions.cco.storage.records or []):
return True
if self.records is not None: if self.records is not None:
return 'favorites' in self.records return 'favorites' in self.records
return False return False

View file

@ -124,8 +124,8 @@ def reindex(obj, catalog=None):
def records(context, name, factory): def records(context, name, factory):
root = context.getLoopsRoot() root = context.getLoopsRoot()
opts = IOptions(root) opts = IOptions(root)
if name in (opts('cco.storage.records') or []): if name in (opts.cco.storage.records or []):
schema = (opts('cco.storage.schema') or [None])[0] schema = (opts.cco.storage.schema or [None])[0]
storage = Storage(getEngine(config.dbengine, config.dbname, storage = Storage(getEngine(config.dbengine, config.dbname,
config.dbuser, config.dbpassword, config.dbuser, config.dbpassword,
host=config.dbhost, port=config.dbport), host=config.dbhost, port=config.dbport),