1 | ## $Id: hostel.py 16615 2021-09-13 12:24:36Z 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 | """ |
---|
19 | These are the custom hostels. |
---|
20 | """ |
---|
21 | import grok |
---|
22 | from zope.component.interfaces import IFactory |
---|
23 | from waeup.kofa.utils.helpers import attrs_to_fields |
---|
24 | from waeup.kofa.hostels.hostel import HostelFactory, BedFactory, Hostel, Bed |
---|
25 | from kofacustom.edocons.hostels.interfaces import ICustomHostel, ICustomBed |
---|
26 | |
---|
27 | class CustomHostel(Hostel): |
---|
28 | """This is a hostel. |
---|
29 | """ |
---|
30 | grok.implements(ICustomHostel) |
---|
31 | grok.provides(ICustomHostel) |
---|
32 | |
---|
33 | CustomHostel = attrs_to_fields(CustomHostel) |
---|
34 | |
---|
35 | class CustomBed(Bed): |
---|
36 | """This is a bed. |
---|
37 | """ |
---|
38 | grok.implements(ICustomBed) |
---|
39 | grok.provides(ICustomBed) |
---|
40 | |
---|
41 | CustomBed = attrs_to_fields(CustomBed) |
---|
42 | |
---|
43 | class 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 | |
---|
53 | class 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) |
---|