コード例 #1
0
ファイル: person.py プロジェクト: achouhans/schooltool-2.8.5
    def filter(self, items):
        if 'CLEAR_SEARCH' in self.request:
            for parameter in self.parameters:
                self.request.form[parameter] = ''
            return items

        if 'SEARCH_GROUP' in self.request:
            group = self.groupContainer().get(self.request['SEARCH_GROUP'])
            if group:
                int_ids = getUtility(IIntIds)
                keys = set([int_ids.queryId(person)
                            for person in group.members])
                items = [item for item in items
                         if item['id'] in keys]

        if 'SEARCH_TITLE' in self.request:
            search_title = self.request['SEARCH_TITLE']
            query = buildQueryString(search_title)
            if query:
                catalog = ICatalog(self.source)
                result = catalog['text'].apply(query)
                items = [item for item in items
                         if item['id'] in result]

        return items
コード例 #2
0
 def filter(self, items):
     if self.search_title_id in self.request:
         search_title = self.request[self.search_title_id]
         query = buildQueryString(search_title)
         if query:
             catalog = self.catalog
             result = catalog['text'].apply(query)
             items = [item for item in items if item['id'] in result]
     return items
コード例 #3
0
ファイル: contact.py プロジェクト: achouhans/schooltool-2.8.5
 def filter(self, items):
     if self.search_title_id in self.request:
         search_title = self.request[self.search_title_id]
         query = buildQueryString(search_title)
         if query:
             catalog = self.catalog
             result = catalog['text'].apply(query)
             items = [item for item in items
                      if item['id'] in result]
     return items
コード例 #4
0
ファイル: person.py プロジェクト: l1ph0x/schooltool-2
    def filter(self, items):
        if 'CLEAR_SEARCH' in self.request:
            for parameter in self.parameters:
                self.request.form[parameter] = ''
            return items

        if 'SEARCH_GROUP' in self.request:
            group = self.groupContainer().get(self.request['SEARCH_GROUP'])
            if group:
                int_ids = getUtility(IIntIds)
                keys = set(
                    [int_ids.queryId(person) for person in group.members])
                items = [item for item in items if item['id'] in keys]

        if 'SEARCH_TITLE' in self.request:
            search_title = self.request['SEARCH_TITLE']
            query = buildQueryString(search_title)
            if query:
                catalog = ICatalog(self.source)
                result = catalog['text'].apply(query)
                items = [item for item in items if item['id'] in result]

        return items