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
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
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
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
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
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
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
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
def criteriaByIndexId(self, indexId): catalog_tool = getToolByName(self, "portal_catalog") indexObj = catalog_tool.Indexes[indexId] results = _criterionRegistry.criteriaByIndex(indexObj.meta_type) return results