예제 #1
0
    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)
예제 #2
0
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)
예제 #3
0
    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")
예제 #4
0
    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)
예제 #5
0
    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)