Changeset 13445
- Timestamp:
- 12 Nov 2015, 09:03:47 (9 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
r13426 r13445 22 22 from zope.i18n import translate 23 23 from zope.component import getUtility 24 from zope.catalog.interfaces import ICatalog 24 25 from waeup.kofa.browser.layout import ( 25 26 KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage, … … 162 163 @action(_('Save'), style='primary') 163 164 def save(self, **data): 165 if data['accommodation_session'] != self.context.accommodation_session: 166 catalog = getUtility(ICatalog, name='beds_catalog') 167 beds = catalog.searchResults(bed_type=(None,None)) 168 if len(beds): 169 self.flash(_('You can\'t change the booking session ' 170 'before clearing all hostels.'), 171 type='warning') 172 return 164 173 self.applyData(self.context, **data) 165 174 self.flash(_('Settings have been saved.')) -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13440 r13445 215 215 self.app['hostels']['hall-x']['hall_block_room_bed'].owner, 216 216 NOT_OCCUPIED) 217 # Accommodation session can't be changed if hostels are not empty. 218 self.browser.open(self.manage_container_path) 219 self.browser.getControl(name="form.accommodation_session").value = ['2005'] 220 self.browser.getControl("Save").click() 221 self.assertTrue( 222 'You can\'t change the booking session before clearing all hostels' 223 in self.browser.contents) 217 224 # Releasing is logged. 218 225 logcontent = open(self.logfile).read()
Note: See TracChangeset for help on using the changeset viewer.