Пример #1
0
 def criteriaByIndexId(self, indexId):
     """ Get criteria by index id
     """
     catalog_tool = getToolByName(self.context, 'portal_catalog')
     indexObj = catalog_tool.Indexes[indexId]
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results
Пример #2
0
 def criteriaByIndexId(self, indexId):
     """ Get criteria by index id
     """
     catalog_tool = getToolByName(self.context, 'portal_catalog')
     indexObj = catalog_tool.Indexes[indexId]
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results
Пример #3
0
 def criteriaByIndexId(self, indexId):
     """ Get criteria by index id
     """
     catalog_tool = getToolByName(self.context, 'portal_catalog')
     indexObj = catalog_tool.Indexes[indexId]
     # allow DateRecurringIndex that is unknown to atct.
     # events in plone.app.contenttypes use it for start and end
     if indexObj.meta_type == 'DateRecurringIndex':
         return ('ATFriendlyDateCriteria', 'ATDateRangeCriterion',
                 'ATSortCriterion')
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results
Пример #4
0
 def criteriaByIndexId(self, indexId):
     """ Get criteria by index id
     """
     catalog_tool = getToolByName(self.context, 'portal_catalog')
     indexObj = catalog_tool.Indexes[indexId]
     # allow DateRecurringIndex that is unknown to atct.
     # events in plone.app.contenttypes use it for start and end
     if indexObj.meta_type == 'DateRecurringIndex':
         return ('ATFriendlyDateCriteria',
                 'ATDateRangeCriterion',
                 'ATSortCriterion')
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results
Пример #5
0
 def criteriaByIndexId(self, indexId):
     """ Get criteria by index id
     """
     catalog_tool = getToolByName(self.context, "portal_catalog")
     try:
         indexObj = catalog_tool.Indexes[indexId]
     except KeyError:
         return []
     # allow DateRecurringIndex that is unknown to atct.
     # events in plone.app.contenttypes use it for start and end
     if indexObj.meta_type == "DateRecurringIndex":
         return ("ATFriendlyDateCriteria", "ATDateRangeCriterion", "ATSortCriterion")
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results
Пример #6
0
 def getCriteriaForIndex(self, index, as_dict=False):
     """ Returns the valid criteria for a given index """
     catalog_tool = getToolByName(self, CatalogTool.id)
     try:
         indexObj = catalog_tool.Indexes[index]
     except KeyError:
         return ()
     criteria = tuple(_criterionRegistry.criteriaByIndex(indexObj.meta_type))
     search_criteria = _criterionRegistry.listSearchTypes()
     if as_dict:
         criteria = [{'name': a, 'description': _criterionRegistry[a].shortDesc}
                             for a in criteria if a in search_criteria]
     else:
         criteria = [a for a in criteria if a in search_criteria]
     criteria.sort()
     return criteria
Пример #7
0
    def criteriaByIndexId(self, indexId):
        """ Get criteria by index id

        XXX: this method is probaly orphaned code
        """
        catalog_tool = getToolByName(self.context, 'portal_catalog')
        try:
            indexObj = catalog_tool.Indexes[indexId]
        except KeyError:
            return []
        # allow DateRecurringIndex that is unknown to atct.
        # events in plone.app.contenttypes use it for start and end
        if indexObj.meta_type == "DateRecurringIndex":
            return ('ATFriendlyDateCriteria', 'ATDateRangeCriterion',
                    'ATSortCriterion')
        results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
        return results
Пример #8
0
 def getCriteriaForIndex(self, index, as_dict=False):
     """ Returns the valid criteria for a given index """
     catalog_tool = getToolByName(self, 'portal_catalog')
     try:
         indexObj = catalog_tool.Indexes[index]
     except KeyError:
         return ()
     criteria = tuple(_criterionRegistry.criteriaByIndex(
         indexObj.meta_type))
     search_criteria = _criterionRegistry.listSearchTypes()
     if as_dict:
         criteria = [{
             'name': a,
             'description': _criterionRegistry[a].shortDesc,
         } for a in criteria if a in search_criteria]
     else:
         criteria = [a for a in criteria if a in search_criteria]
     criteria.sort()
     return criteria
Пример #9
0
 def criteriaByIndexId(self, indexId):
     catalog_tool = getToolByName(self, "portal_catalog")
     indexObj = catalog_tool.Indexes[indexId]
     results = _criterionRegistry.criteriaByIndex(indexObj.meta_type)
     return results