Changeset 15633
- Timestamp:
- 3 Oct 2019, 10:09:25 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r15254 r15633 21 21 import sys 22 22 from zope.i18n import translate 23 from zope.component import getUtility 23 from zope.component import getUtility, createObject 24 24 from zope.catalog.interfaces import ICatalog 25 25 from waeup.kofa.browser.layout import ( … … 273 273 @action(_('Create hostel')) 274 274 def addHostel(self, **data): 275 hostel = Hostel()275 hostel = container = createObject(u'waeup.Hostel') 276 276 self.applyData(hostel, **data) 277 277 hostel.hostel_id = data['hostel_name'].lower().replace( -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
r15417 r15633 21 21 import grok 22 22 from zope.event import notify 23 from zope.component import getUtility 23 from zope.component import getUtility, createObject 24 24 from zope.component.interfaces import IFactory 25 25 from datetime import datetime … … 127 127 notify(grok.ObjectModifiedEvent(bed)) 128 128 else: 129 bed = Bed()129 bed = createObject(u'waeup.Bed') 130 130 bed.bed_id = uid 131 131 bed.bed_type = bt … … 309 309 return implementedBy(Hostel) 310 310 311 class BedFactory(grok.GlobalUtility): 312 """A factory for beds. 313 314 We need this factory to ease customization. 315 """ 316 grok.implements(IFactory) 317 grok.name(u'waeup.Bed') 318 title = u"Create a new bed.", 319 description = u"This factory instantiates new bed instances." 320 321 def __call__(self, *args, **kw): 322 return Bed() 323 324 def getInterfaces(self): 325 return implementedBy(Bed) 326 311 327 312 328 @grok.subscribe(IBedTicket, grok.IObjectRemovedEvent)
Note: See TracChangeset for help on using the changeset viewer.