Changeset 7006


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

Add missing handler.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 edited

Legend:

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

    r6972 r7006  
    1717    grok.context(IBed)
    1818
    19     bed_number = index.Field(attribute='bed_number')
     19    #bed_id = index.Field(attribute='bed_id')
     20    #bed_number = index.Field(attribute='bed_number')
    2021    bed_type = index.Field(attribute='bed_type')
    2122    owner = index.Field(attribute='owner')
  • 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))
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7004 r7006  
    1616"""UI components for students and related components.
    1717"""
     18import sys
    1819import grok
    1920from time import time
     
    11541155        bed = selectBed(available_beds)
    11551156        bed.bookBed(student.student_id)
    1156         bedticket.bed = bed # maybe wo don't need the bed object itself and can
    1157                             # remove that later
     1157        bedticket.bed = bed
    11581158        hall_title = bed.__parent__.hostel_name
    11591159        coordinates = bed.getBedCoordinates()[1:]
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7005 r7006  
    888888        ctrl.getControl(value=value).selected = True
    889889        self.browser.getControl("Remove selected", index=0).click()
    890         self.assertTrue('Successfully removed' in self.browser.contents)
     890        self.assertMatches('...Successfully removed...', self.browser.contents)
    891891        # Due to an event handler also the bed has been released properly
    892892        bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
Note: See TracChangeset for help on using the changeset viewer.