def search(self, query): query = query.strip().lower() results = [] for provider in SidebarItemProvider.all(self.context): for item in provider.provide(): if "url" in item: search_source = "$".join([item.get("id", ""), item.get("name", "")]).lower() if query in search_source: results.append({"title": item["name"], "icon": item["icon"], "url": item["url"]}) return results
def provide(self): sidebar_perms = [ {"id": "sidebar:view:%s" % item["url"], "name": item["name"], "default": True} for provider in SidebarItemProvider.all(self.context) for item in provider.provide() if "url" in item ] return [ {"id": "core:config:read", "name": "Read configuration file", "default": True}, {"id": "core:config:write", "name": "Write configuration file", "default": True}, ] + sidebar_perms
def search(self, query): query = query.strip().lower() results = [] for provider in SidebarItemProvider.all(self.context): for item in provider.provide(): if 'url' in item: search_source = '$'.join([item.get('id', ''), item.get('name', '')]).lower() if query in search_source: results.append({ 'title': item['name'], 'icon': item['icon'], 'url': item['url'], }) return results
def provide(self): sidebar_perms = [{ 'id': f'sidebar:view:{item["url"]}', 'name': item['name'], 'default': True, } for provider in SidebarItemProvider.all(self.context) for item in provider.provide() if 'url' in item] return [ { 'id': 'core:config:read', 'name': _('Read configuration file'), 'default': True, }, { 'id': 'core:config:write', 'name': _('Write configuration file'), 'default': True, }, ] + sidebar_perms
def provide(self): sidebar_perms = [ { 'id': 'sidebar:view:%s' % item['url'], 'name': item['name'], 'default': True, } for provider in SidebarItemProvider.all(self.context) for item in provider.provide() if 'url' in item ] return [ { 'id': 'core:config:read', 'name': _('Read configuration file'), 'default': True, }, { 'id': 'core:config:write', 'name': _('Write configuration file'), 'default': True, }, ] + sidebar_perms