Last change
on this file since 4825 was
3737,
checked in by hraban, 16 years ago
|
Adding and editing of all objects works now. Templates enhanced (not only for debugging). Still no tests. Added SVN-IDs.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1010 bytes
|
Rev | Line | |
---|
[3737] | 1 | # $Id: catalog.py 3737 2008-10-26 19:14:17Z hraban $ |
---|
[3557] | 2 | import grok, grok.index |
---|
[3521] | 3 | from hurry.query.query import Query, Text |
---|
| 4 | from hurry.query import Eq |
---|
[3557] | 5 | from waeup.app import University |
---|
[3571] | 6 | from waeup.students.interfaces import IStudent, IStudentContainer |
---|
[3557] | 7 | from waeup.students.student import Student |
---|
| 8 | from waeup.viewlets import MainArea, LeftSidebar |
---|
[3521] | 9 | |
---|
| 10 | class StudentIndexes(grok.Indexes): |
---|
| 11 | grok.site(University) |
---|
| 12 | grok.name('students_catalog') |
---|
[3571] | 13 | grok.context(IStudentContainer) |
---|
[3521] | 14 | |
---|
[3557] | 15 | name = grok.index.Field(attribute='name') |
---|
[3521] | 16 | |
---|
| 17 | |
---|
[3557] | 18 | class StudentSearch(grok.Viewlet): |
---|
[3571] | 19 | grok.context(IStudentContainer) |
---|
[3557] | 20 | grok.viewletmanager(LeftSidebar) |
---|
| 21 | #grok.view(Student) |
---|
[3571] | 22 | grok.order(3) |
---|
[3521] | 23 | |
---|
| 24 | def update(self, query=None): |
---|
| 25 | self.search_result = [] |
---|
| 26 | if query is not None: |
---|
| 27 | self.search_result = self.search_context(query) |
---|
| 28 | print "RESULT: ", list(self.search_result) |
---|
| 29 | |
---|
| 30 | def search_context(self, query): |
---|
| 31 | result = Query().searchResults( |
---|
| 32 | Eq(('students_catalog', 'name'), query) |
---|
| 33 | ) |
---|
| 34 | return result |
---|
| 35 | |
---|
Note: See
TracBrowser for help on using the repository browser.