source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/hostels/hostel.py @ 17519

Last change on this file since 17519 was 15646, checked in by Henrik Bettermann, 5 years ago

Add custom hostel module.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1## $Id: hostel.py 15646 2019-10-04 21:12:17Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19These are the custom hostels.
20"""
21import grok
22from zope.component.interfaces import IFactory
23from waeup.kofa.utils.helpers import attrs_to_fields
24from waeup.kofa.hostels.hostel import HostelFactory, BedFactory, Hostel, Bed
25from kofacustom.iuokada.hostels.interfaces import ICustomHostel, ICustomBed
26
27class CustomHostel(Hostel):
28    """This is a hostel.
29    """
30    grok.implements(ICustomHostel)
31    grok.provides(ICustomHostel)
32
33CustomHostel = attrs_to_fields(CustomHostel)
34
35class CustomBed(Bed):
36    """This is a bed.
37    """
38    grok.implements(ICustomBed)
39    grok.provides(ICustomBed)
40
41CustomBed = attrs_to_fields(CustomBed)
42
43class CustomHostelFactory(HostelFactory):
44    """A factory for hostels.
45    """
46
47    def __call__(self, *args, **kw):
48        return CustomHostel()
49
50    def getInterfaces(self):
51        return implementedBy(CustomHostel)
52
53class CustomBedFactory(BedFactory):
54    """A factory for beds.
55    """
56
57    def __call__(self, *args, **kw):
58        return CustomBed()
59
60    def getInterfaces(self):
61        return implementedBy(CustomBed)
Note: See TracBrowser for help on using the repository browser.