Changeset 6420 for main/waeup.sirp/trunk
- Timestamp:
- 20 Jun 2011, 14:44:37 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/accesscodes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py
r6418 r6420 411 411 return code 412 412 413 def fire_transition(access_code, arg, toward=False ):413 def fire_transition(access_code, arg, toward=False, comment=None): 414 414 """Fire workflow transition for access code. 415 415 … … 424 424 transition id as `arg`, otherwise you must give a transition 425 425 target. 426 427 If `comment` is specified (default is ``None``) the given string 428 will be passed along as transition comment. It will appear in the 429 history of the changed access code. You can use this to place 430 remarks like for which object the access code was used or similar. 426 431 427 432 :func:`fire_transition` might raise exceptions depending on the … … 458 463 info = IWorkflowInfo(ac) 459 464 if toward: 460 info.fireTransitionToward(arg )465 info.fireTransitionToward(arg, comment=comment) 461 466 else: 462 info.fireTransition(arg )467 info.fireTransition(arg, comment=comment) 463 468 return True 464 469 465 def invalidate_accesscode(access_code ):470 def invalidate_accesscode(access_code, comment=None): 466 471 """Invalidate AccessCode denoted by string ``access_code``. 467 472 468 473 Fires an appropriate transition to perform the task. 474 475 `comment` is a string that will appear in the access code 476 history. 469 477 470 478 See :func:`fire_transition` for possible exceptions and their 471 479 meanings. 472 480 """ 473 return fire_transition(access_code, 'use' )474 475 def disable_accesscode(access_code ):481 return fire_transition(access_code, 'use', comment=comment) 482 483 def disable_accesscode(access_code, comment=None): 476 484 """Disable AccessCode denoted by string ``access_code``. 477 485 478 486 Fires an appropriate transition to perform the task. 487 488 `comment` is a string that will appear in the access code 489 history. 479 490 480 491 See :func:`fire_transition` for possible exceptions and their 481 492 meanings. 482 493 """ 483 return fire_transition(access_code, DISABLED, toward=True) 484 485 def reenable_accesscode(access_code): 494 return fire_transition( 495 access_code, DISABLED, toward=True, comment=comment) 496 497 def reenable_accesscode(access_code, comment=None): 486 498 """Reenable AccessCode denoted by string ``access_code``. 487 499 488 500 Fires an appropriate transition to perform the task. 501 502 `comment` is a string that will appear in the access code 503 history. 489 504 490 505 See :func:`fire_transition` for possible exceptions and their 491 506 meanings. 492 507 """ 493 return fire_transition(access_code, 'reenable' )508 return fire_transition(access_code, 'reenable', comment=comment) -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/workflow.py
r6413 r6420 119 119 msg = '%s - %s (new state: %s)' % ( 120 120 timestamp, event.destination.title, event.destination) 121 if event.comment is not None: 122 msg = '%s, %s' % (msg, event.comment) 121 123 history = IObjectHistory(obj) 122 124 history.addMessage(msg)
Note: See TracChangeset for help on using the changeset viewer.