Ignore:
Timestamp:
6 Nov 2011, 10:11:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Add missing handler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py

    r7003 r7006  
    2323from waeup.sirp.utils.helpers import attrs_to_fields
    2424from waeup.sirp.hostels.interfaces import IHostel, IBed
     25from waeup.sirp.students.interfaces import IBedTicket
    2526
    2627NOT_OCCUPIED = u'not occupied'
     
    181182
    182183Bed = attrs_to_fields(Bed)
     184
     185@grok.subscribe(IBedTicket, grok.IObjectRemovedEvent)
     186def handle_bedticket_removed(bedticket, event):
     187    """If a bed ticket is deleted, we make sure that also the owner attribute
     188    of the bed is cleared (set to NOT_OCCUPIED).
     189    """
     190    allocated_bed = bedticket.bed
     191    allocated_bed.owner = NOT_OCCUPIED
     192    notify(grok.ObjectModifiedEvent(allocated_bed))
Note: See TracChangeset for help on using the changeset viewer.