Last change
on this file since 5086 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 | |
---|
1 | import os |
---|
2 | import grok |
---|
3 | from grok import index |
---|
4 | from hurry.query.query import Query, Text |
---|
5 | from hurry.query import Eq |
---|
6 | from waeup.sirp.app import University |
---|
7 | from waeup.sirp.interfaces import IQueryResultItem |
---|
8 | from waeup.sirp.student.interfaces import IStudent |
---|
9 | |
---|
10 | |
---|
11 | class 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 | |
---|
18 | class 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 | |
---|
30 | def 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.