Changeset 5090 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 30 Mar 2010, 13:27:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/catalog.py
r5007 r5090 1 import os 1 """Components to help cataloging and searching objects. 2 """ 2 3 import grok 3 from grok import index4 from hurry.query.query import Query, Text5 4 from hurry.query import Eq 5 from hurry.query.interfaces import IQuery 6 from hurry.query.query import Query 7 from zope.catalog.catalog import ResultSet 8 from zope.intid.interfaces import IIntIds 9 6 10 from waeup.sirp.app import University 7 11 from waeup.sirp.interfaces import IQueryResultItem 8 12 from waeup.sirp.student.interfaces import IStudent 13 14 class WAeUPQuery(Query): 15 """A hurry.query-like query that supports also ``apply``. 16 """ 17 grok.implements(IQuery) 18 19 def apply(self, query): 20 """Get a catalog's BTree set of intids conforming to a query. 21 """ 22 return query.apply() 23 24 def searchResults(self, query): 25 """Get a set of ZODB objects conforming to a query. 26 """ 27 results = self.apply(query) 28 if results is not None: 29 uidutil = getUtility(IIntIds) 30 results = ResultSet(results, uidutil) 31 return results 9 32 10 33
Note: See TracChangeset for help on using the changeset viewer.