## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """ These are the hostels. """ import grok from datetime import datetime from grok import index from waeup.sirp.utils.helpers import attrs_to_fields from waeup.sirp.hostels.interfaces import IHostel, IBed class Hostel(grok.Container): """This is a hostel. """ grok.implements(IHostel) grok.provides(IHostel) def loggerInfo(self, ob_class, comment=None): target = self.__name__ return grok.getSite()['hostels'].logger_info(ob_class,target,comment) def addBed(self, bed): """Add a hostel. """ if not IBed.providedBy(bed): raise TypeError( 'Hostels contain only IBed instances') self[hostel.bed_id] = bed return Hostel = attrs_to_fields(Hostel) class Bed(grok.Container): """This is a bed. """ grok.implements(IBed) grok.provides(IBed) def getBedCoordinates(self): """Determine the coordinates from bed_id. """ pass def loggerInfo(self, ob_class, comment=None): target = self.__name__ return grok.getSite()['hostels'].logger_info(ob_class,target,comment) Bed = attrs_to_fields(Bed)