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

Last change on this file since 5085 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
Line 
1import os
2import grok
3from grok import index
4from hurry.query.query import Query, Text
5from hurry.query import Eq
6from waeup.sirp.app import University
7from waeup.sirp.interfaces import IQueryResultItem
8from waeup.sirp.student.interfaces import IStudent
9
10
11class StudentIndexes(grok.Indexes):
12     grok.site(University)
13     grok.name('students_catalog')
14     grok.context(IStudent)
15
16     name = grok.index.Field(attribute='name')
17
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.