Changeset 13529 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 2 Dec 2015, 20:15:36 (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
r13494 r13529 192 192 193 193 def update(self, n=7): 194 if not grok.getSite()['configuration'].maintmode_enabled_by: 195 self.flash( 196 _('Portal must be in maintenance mode for releasing expired ' 197 'bed allocations.'), 198 type='danger') 199 self.redirect(self.url(self.context)) 200 return 194 201 released = self.context.releaseExpiredAllocations(n) 195 202 if len(released): 196 203 message = ', '.join(released) 197 204 self.context.writeLogMessage(self, 'released: %s' % message) 198 flash_msg = _('Successfully released beds: ${a}', mapping = {'a':message}) 205 flash_msg = _('Successfully released beds: ${a}', 206 mapping = {'a':message}) 199 207 else: 200 208 flash_msg = _('No bed released.') … … 296 304 ' You really want to update?')) 297 305 def updateBeds(self, **data): 306 if not grok.getSite()['configuration'].maintmode_enabled_by: 307 self.flash( 308 _('Portal must be in maintenance mode for bed updates.'), 309 type='danger') 310 self.redirect(self.url(self.context, '@@manage')+'#tab2') 311 return 298 312 removed, added, modified, modified_beds = self.context.updateBeds() 299 313 message = '%d empty beds removed, %d beds added, %d occupied beds modified (%s)' % ( -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13484 r13529 201 201 self.assertEqual(len(results), 1) 202 202 self.browser.open(self.container_path + '/releaseexpired') 203 self.assertTrue('Portal must be in maintenance mode for releasing expired bed allocations' 204 in self.browser.contents) 205 grok.getSite()['configuration'].maintmode_enabled_by = u'any_id' 206 self.browser.open(self.container_path + '/releaseexpired') 203 207 self.assertTrue('No bed released' in self.browser.contents) 204 208 delta = timedelta(days=10) … … 339 343 hall.beds_for_final = ['C'] 340 344 hall.beds_for_all = ['D','E'] 345 self.browser.getControl("Update all beds").click() 346 self.assertTrue('Portal must be in maintenance mode for bed updates' 347 in self.browser.contents) 348 grok.getSite()['configuration'].maintmode_enabled_by = u'any_id' 341 349 self.browser.getControl("Update all beds").click() 342 350 expected = '...0 empty beds removed, 10 beds added, 0 occupied beds modified ()...' … … 507 515 508 516 def test_clear_hostels(self): 517 grok.getSite()['configuration'].maintmode_enabled_by = u'any_id' 509 518 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 510 519 self.browser.open(self.container_path)
Note: See TracChangeset for help on using the changeset viewer.