def search(self, query): """search the catalog """ logger.info("Catalog query={}".format(query)) # Support to set the catalog as a request parameter catalogs = _.to_list(req.get("catalog", None)) if catalogs: return senaiteapi.search(query, catalog=catalogs) # Delegate to the search API of Bika LIMS return senaiteapi.search(query)
def search(query=None, catalog=None): """Search """ if query is None: query = make_query() if query is None: return [] return api.search(query, catalog=catalog)
def setupitems(self): """Lookup available setup items :returns: catalog brains """ query = { "path": { "query": api.get_path(self.setup), "depth": 1, }, "sort_on": "sortable_title", "sort_order": "ascending" } return api.search(query, "portal_catalog")
def setupitems(self): """Lookup available setup items :returns: catalog brains """ query = { "path": { "query": api.get_path(self.setup), "depth": 1, }, "sort_on": "sortable_title", "sort_order": "ascending" } items = api.search(query, "portal_catalog") return filter(lambda item: not item.exclude_from_nav, items)
def setupitems(self): """Lookup available setup items :returns: catalog brains """ query = { "path": { "query": api.get_path(self.setup), "depth": 1, }, } items = api.search(query, "portal_catalog") # filter out items items = filter(lambda item: not item.exclude_from_nav, items) # sort by (translated) title def cmp_by_translated_title(brain1, brain2): title1 = t(api.get_title(brain1)) title2 = t(api.get_title(brain2)) return cmp(title1, title2) return sorted(items, cmp=cmp_by_translated_title)