source: main/waeup.sirp/trunk/src/waeup/sirp/catalog.py @ 5015

Last change on this file since 5015 was 5007, checked in by uli, 15 years ago
  • Move academics-related catalog components into university subpackage.
  • Move interface into interfaces.py where it belongs.
  • Update pages.py to reflect the changes above.
  • Property svn:eol-style set to native
File size: 892 bytes
RevLine 
[3521]1import os
2import grok
3from grok import index
4from hurry.query.query import Query, Text
5from hurry.query import Eq
[4920]6from waeup.sirp.app import University
[5007]7from waeup.sirp.interfaces import IQueryResultItem
[4920]8from waeup.sirp.student.interfaces import IStudent
[3521]9
[4789]10
[3521]11class StudentIndexes(grok.Indexes):
12     grok.site(University)
13     grok.name('students_catalog')
14     grok.context(IStudent)
15
[5007]16     name = grok.index.Field(attribute='name')
[3521]17
[4789]18class QueryResultItem(object):
19     grok.implements(IQueryResultItem)
20     url = None
21     title = None
22     description = None
23     
24     def __init__(self, context, view):
25          self.context = context
26          self.url = view.url(context)
27          self.title = context.title
28          self.description = ''
29
30def search_context(query):
31     result = Query().searchResults(
32          Eq(('students_catalog', 'name'), query)
33          )
34     return result
Note: See TracBrowser for help on using the repository browser.