Changeset 5153 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 13 Apr 2010, 16:45:57 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py
r5149 r5153 354 354 return results 355 355 356 def getAccessCode(self, ac_id): 357 """Get the AccessCode with ID ``ac_id`` or ``KeyError``. 358 """ 359 for batchname in self.keys(): 360 batch = self[batchname] 361 try: 362 return batch.getAccessCode(ac_id) 363 except KeyError: 364 continue 365 return None 366 367 def disable(self, ac_id, user_id): 368 """Disable the AC with ID ``ac_id``. 369 370 ``user_id`` is the user ID of the user triggering the 371 process. Already disabled ACs are left untouched. 372 """ 373 ac = self.getAccessCode(ac_id) 374 if ac is None: 375 return 376 ac.__parent__.disable(ac_id, user_id) 377 return 378 379 def enable(self, ac_id): 380 """(Re-)enable the AC with ID ``ac_id``. 381 382 This leaves the given AC in state ``unused``. Already enabled 383 ACs are left untouched. 384 """ 385 ac = self.getAccessCode(ac_id) 386 if ac is None: 387 return 388 ac.__parent__.enable(ac_id) 389 return 390 391 356 392 class AccessCodePlugin(grok.GlobalUtility): 357 393 grok.name('accesscodes')
Note: See TracChangeset for help on using the changeset viewer.