def getCriterias(self, locales, q=None): ''' @see: QueryCriteriaService.getCriterias ''' locales = self._localesOf(locales) queryCriterias = list() for key, metaInfos in self.queryIndexer.metaInfoByCriteria.items(): types = ''.join([ (self.queryIndexer.typesByMetaInfo[metaInfo.__name__] + '-') for metaInfo in metaInfos ]) criteria = self.queryIndexer.infoCriterias[key] queryCriterias.append( QueryCriteria('qi.' + key, criteria.__name__, types, key)) for key, metaDatas in self.queryIndexer.metaDataByCriteria.items(): types = ''.join([ (self.queryIndexer.typesByMetaData[metaData.__name__] + '-') for metaData in metaDatas ]) criteria = self.queryIndexer.dataCriterias[key] queryCriterias.append( QueryCriteria('qd.' + key, criteria.__name__, types, key)) if q: queryCriterias = processQuery(queryCriterias, q, QueryCriteria) return queryCriterias
def getComponents(self, offset=None, limit=None, q=None): ''' @see: IComponentService.getComponents ''' modules = modulesIn('%s.*' % self.package).asList() modules.sort() components = (self.componentFor(module) for module in modules) length = len(modules) if q: assert isinstance(q, QComponent), 'Invalid query %s' % q components = processQuery(components, q, Component) length = len(components) return IterPart(trimIter(components, length, offset, limit), length, offset, limit)
def getAllAvailable(self, locales, offset=None, limit=None, q=None): ''' @see: ILanguageService.getAllAvailable ''' locales = self._localesOf(locales) if q: countries = (Country(code, self._translate(code, locales)) for code in self.countries) countries = processQuery(countries, q, Country) length = len(countries) countries = trimIter(countries, length, offset, limit) else: length = len(self.countries) countries = trimIter(self.countries, length, offset, limit) countries = (Country(code, self._translate(code, locales)) for code in countries) return IterPart(countries, length, offset, limit)
def getAllAvailable(self, locales, offset=None, limit=None, q=None): ''' @see: ILanguageService.getAllAvailable ''' locales = self._localesOf(locales) if q: languages = (self._populate(Language(code), self._translator(locale, locales)) for code, locale in self._locales.items()) languages = processQuery(languages, q, Language) length = len(languages) languages = trimIter(languages, length, offset, limit) else: length = len(self._locales) languages = trimIter(self._locales.items(), length, offset, limit) languages = (self._populate(Language(code), self._translator(locale, locales)) for code, locale in languages) return IterPart(languages, length, offset, limit)
def getCriterias(self, locales, q=None): ''' @see: QueryCriteriaService.getCriterias ''' locales = self._localesOf(locales) queryCriterias = list() for key, criteria in self.queryIndexer.infoCriterias.items(): queryCriterias.append(QueryCriteria(key, criteria.__name__, key))#TODO: self._translate(key, locales))) for key, criteria in self.queryIndexer.dataCriterias.items(): queryCriterias.append(QueryCriteria('qd.' + key, criteria.__name__, key))#TODO: self._translate(key, locales))) if q: queryCriterias = processQuery(queryCriterias, q, QueryCriteria) return queryCriterias
def getCriterias(self, locales, q=None): ''' @see: QueryCriteriaService.getCriterias ''' locales = self._localesOf(locales) queryCriterias = list() for key, metaInfos in self.queryIndexer.metaInfoByCriteria.items(): types = ''.join([(self.queryIndexer.typesByMetaInfo[metaInfo.__name__] + '-') for metaInfo in metaInfos]) criteria = self.queryIndexer.infoCriterias[key] queryCriterias.append(QueryCriteria('qi.' + key, criteria.__name__, types, key)) for key, metaDatas in self.queryIndexer.metaDataByCriteria.items(): types = ''.join([(self.queryIndexer.typesByMetaData[metaData.__name__] + '-') for metaData in metaDatas]) criteria = self.queryIndexer.dataCriterias[key] queryCriterias.append(QueryCriteria('qd.' + key, criteria.__name__, types, key)) if q: queryCriterias = processQuery(queryCriterias, q, QueryCriteria) return queryCriterias
def getCriterias(self, locales, q=None): ''' @see: QueryCriteriaService.getCriterias ''' locales = self._localesOf(locales) queryCriterias = list() for key, criteria in self.queryIndexer.infoCriterias.items(): queryCriterias.append( QueryCriteria(key, criteria.__name__, key)) #TODO: self._translate(key, locales))) for key, criteria in self.queryIndexer.dataCriterias.items(): queryCriterias.append( QueryCriteria('qd.' + key, criteria.__name__, key)) #TODO: self._translate(key, locales))) if q: queryCriterias = processQuery(queryCriterias, q, QueryCriteria) return queryCriterias