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

Last change on this file since 6982 was 6972, checked in by Henrik Bettermann, 13 years ago

Add beds_catalog.

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1"""Cataloging and searching components for hostels.
2"""
3import grok
4from grok import index
5from hurry.query import Eq, Text
6from hurry.query.query import Query
7from zope.catalog.interfaces import ICatalog
8from zope.component import queryUtility
9from waeup.sirp.interfaces import IUniversity, IQueryResultItem
10from waeup.sirp.hostels.interfaces import IBed
11
12class BedIndexes(grok.Indexes):
13    """A catalog for beds.
14    """
15    grok.site(IUniversity)
16    grok.name('beds_catalog')
17    grok.context(IBed)
18
19    bed_number = index.Field(attribute='bed_number')
20    bed_type = index.Field(attribute='bed_type')
21    owner = index.Field(attribute='owner')
22
23class BedQueryResultItem(object):
24    grok.implements(IQueryResultItem)
25
26    title = u'Bed Query Item'
27    description = u'Some bed found in a search'
28
29    def __init__(self, context, view):
30        self.context = context
31        self.url = view.url(context)
32        self.bed_id = context.bed_id
33        self.bed_type = context.bed_type
34        self.bed_number = context.bed_number
Note: See TracBrowser for help on using the repository browser.