Changeset 13050 for main/waeup.kofa
- Timestamp:
- 15 Jun 2015, 14:35:38 (9 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r13047 r13050 2046 2046 if len(entries): 2047 2047 # If bed space has been manually allocated use this bed 2048 manual = True 2048 2049 bed = [entry for entry in entries][0] 2049 2050 # Safety belt for paranoids: Does this bed really exist on portal? … … 2057 2058 else: 2058 2059 # else search for other available beds 2060 manual = False 2059 2061 entries = cat.searchResults( 2060 2062 bed_type=(acc_details['bt'],acc_details['bt'])) … … 2084 2086 self.flash(_('Activation code has already been used.'), 2085 2087 type="warning") 2088 if not manual: 2089 # Release the previously booked bed 2090 bed.owner = NOT_OCCUPIED 2091 # Catalog must be informed 2092 notify(grok.ObjectModifiedEvent(bed)) 2086 2093 return 2087 2094 else: … … 2089 2096 # Here we know that the ac is in state initialized so we do not 2090 2097 # expect an exception, but the owner might be different 2091 if not invalidate_accesscode( 2092 pin,comment,self.context.student.student_id): 2098 success = invalidate_accesscode( 2099 pin, comment, self.context.student.student_id) 2100 if not success: 2093 2101 self.flash(_('You are not the owner of this access code.'), 2094 2102 type="warning") 2103 if not manual: 2104 # Release the previously booked bed 2105 bed.owner = NOT_OCCUPIED 2106 # Catalog must be informed 2107 notify(grok.ObjectModifiedEvent(bed)) 2095 2108 return 2096 2109 # Create bed ticket -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13047 r13050 3006 3006 self.assertMatches('...Activation Code:...', 3007 3007 self.browser.contents) 3008 # Student can't use dfaked ACs ...3008 # Student can't use faked ACs ... 3009 3009 self.browser.getControl(name="ac_series").value = u'nonsense' 3010 3010 self.browser.getControl(name="ac_number").value = sfenumber … … 3019 3019 self.assertMatches('...You are not the owner of this access code...', 3020 3020 self.browser.contents) 3021 # The bed remains empty 3022 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 3023 self.assertTrue(bed.owner == NOT_OCCUPIED) 3021 3024 ac.owner = self.student_id 3022 3025 self.browser.getControl(name="ac_series").value = sfeseries … … 3026 3029 self.browser.contents) 3027 3030 # Bed has been allocated 3028 bed = self.app['hostels']['hall-1']['hall-1_A_101_A']3029 3031 self.assertTrue(bed.owner == self.student_id) 3030 3032 # BedTicketAddPage is now blocked
Note: See TracChangeset for help on using the changeset viewer.