Package trac :: Package ticket :: Module api :: Class ITicketActionController

Class ITicketActionController

source code

    object --+    
             |    
core.Interface --+
                 |
                ITicketActionController

Extension point interface for components willing to participate in the ticket workflow.

This is mainly about controlling the changes to the ticket ''status'', though not restricted to it.

Instance Methods
 
get_ticket_actions(req, ticket)
Return an iterable of (weight, action) tuples corresponding to the actions that are contributed by this component.
source code
 
get_all_status()
Returns an iterable of all the possible values for the ''status'' field this action controller knows about.
source code
 
render_ticket_action_control(req, ticket, action)
Return a tuple in the form of (label, control, hint)
source code
 
get_ticket_changes(req, ticket, action)
Return a dictionary of ticket field changes.
source code
 
apply_action_side_effects(req, ticket, action)
Perform side effects once all changes have been made to the ticket.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

get_ticket_actions(req, ticket)

source code 

Return an iterable of (weight, action) tuples corresponding to the actions that are contributed by this component. The list is dependent on the current state of the ticket and the actual request parameter.

action is a key used to identify that particular action. (note that 'history' and 'diff' are reserved and should not be used by plugins)

The actions will be presented on the page in descending order of the integer weight. The first action in the list is used as the default action.

When in doubt, use a weight of 0.

get_all_status()

source code 

Returns an iterable of all the possible values for the ''status'' field this action controller knows about.

This will be used to populate the query options and the like. It is assumed that the initial status of a ticket is 'new' and the terminal status of a ticket is 'closed'.

render_ticket_action_control(req, ticket, action)

source code 

Return a tuple in the form of (label, control, hint)

label is a short text that will be used when listing the action, control is the markup for the action control and hint should explain what will happen if this action is taken.

This method will only be called if the controller claimed to handle the given action in the call to get_ticket_actions.

Note that the radio button for the action has an id of "action_%s" % action. Any id`s used in `control need to be made unique. The method used in the default ITicketActionController is to use "action_%s_something" % action.

get_ticket_changes(req, ticket, action)

source code 

Return a dictionary of ticket field changes.

This method must not have any side-effects because it will also be called in preview mode (req.args['preview'] will be set, then). See apply_action_side_effects for that. If the latter indeed triggers some side-effects, it is advised to emit a warning (trac.web.chrome.add_warning(req, reason)) when this method is called in preview mode.

This method will only be called if the controller claimed to handle the given action in the call to get_ticket_actions.

apply_action_side_effects(req, ticket, action)

source code 

Perform side effects once all changes have been made to the ticket.

Multiple controllers might be involved, so the apply side-effects offers a chance to trigger a side-effect based on the given action after the new state of the ticket has been saved.

This method will only be called if the controller claimed to handle the given action in the call to get_ticket_actions.