Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 def getAllRequests(self, offset=None, limit=None):
     '''
     @see: IRequestService.getAllRequests
     '''
     self._refresh()
     return IterPart(trimIter(self._requests.values(), len(self._requests), offset, limit), len(self._requests),
                     offset, limit)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
    def getPlugins(self, offset=None, limit=None):
        '''
        @see: IPluginService.getPlugins
        '''
        modules = modulesIn('__plugin__.*').asList()
        modules.sort()

        components = {cmp.Path:cmp.Id for cmp in self.componentService.getComponents()}
        plugins = (self.pluginFor(module, components) for module in modules)

        return IterPart(trimIter(plugins, len(modules), offset, limit), len(modules), offset, limit)
Ejemplo n.º 5
0
    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)