Ignore:
Timestamp:
4 Nov 2011, 21:26:33 (13 years ago)
Author:
Henrik Bettermann
Message:

We have to call notify(grok.ObjectModifiedEvent?(self)) to update the catalog when only an attribute is changed.

Only one bed per student is allowed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6997 r7003  
    11081108            self.flash('Activation code is invalid.')
    11091109            return
    1110         # Search a bed and exit if no bed is found
     1110        # Search a bed and exit if no bed is found or if the student
     1111        # has already booked a bed
    11111112        cat = queryUtility(ICatalog, name='beds_catalog', default=None)
    11121113        entries = cat.searchResults(
     
    11171118            self.flash('There is no free bed in your category %s.'
    11181119                        % acc_details['bt'])
     1120            return
     1121        entries = cat.searchResults(
     1122            owner=(student.student_id,student.student_id))
     1123        if len(entries):
     1124            bed = [entry for entry in entries][0]
     1125            self.flash('You already booked bed %s.'
     1126                        % bed.bed_id)
    11191127            return
    11201128        # Mark pin as used (this also fires a pin related transition)
Note: See TracChangeset for help on using the changeset viewer.