trac.ticket.api
¶
-
class
trac.ticket.api.
IMilestoneChangeListener
¶ Bases:
trac.core.Interface
Extension point interface for components that require notification when milestones are created, modified, or deleted.
-
milestone_changed
(milestone, old_values)¶ Called when a milestone is modified.
old_values
is a dictionary containing the previous values of the milestone properties that changed. Currently those properties can be ‘name’, ‘due’, ‘completed’, or ‘description’.
-
milestone_created
(milestone)¶ Called when a milestone is created.
-
milestone_deleted
(milestone)¶ Called when a milestone is deleted.
-
-
class
trac.ticket.api.
ITicketActionController
¶ Bases:
trac.core.Interface
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.
-
apply_action_side_effects
(req, ticket, action)¶ 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 toget_ticket_actions
.
-
get_all_status
()¶ 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’.
-
get_ticket_actions
(req, ticket)¶ 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_ticket_changes
(req, ticket, action)¶ 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). Seeapply_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 toget_ticket_actions
.
-
render_ticket_action_control
(req, ticket, action)¶ 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 andhint
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 toget_ticket_actions
.Note that the radio button for the action has an
id
of"action_%s" % action
. Anyid`s used in `control
need to be made unique. The method used in the default ITicketActionController is to use"action_%s_something" % action
.
-
-
class
trac.ticket.api.
ITicketChangeListener
¶ Bases:
trac.core.Interface
Extension point interface for components that require notification when tickets are created, modified, or deleted.
-
ticket_change_deleted
(ticket, cdate, changes)¶ Called when a ticket change is deleted.
changes
is a dictionary of tuple(oldvalue, newvalue)
containing the ticket change of the fields that have changed.
-
ticket_changed
(ticket, comment, author, old_values)¶ Called when a ticket is modified.
old_values
is a dictionary containing the previous values of the fields that have changed.
-
ticket_comment_modified
(ticket, cdate, author, comment, old_comment)¶ Called when a ticket comment is modified.
-
ticket_created
(ticket)¶ Called when a ticket is created.
-
ticket_deleted
(ticket)¶ Called when a ticket is deleted.
-
-
class
trac.ticket.api.
ITicketManipulator
¶ Bases:
trac.core.Interface
Miscellaneous manipulation of ticket workflow features.
-
prepare_ticket
(req, ticket, fields, actions)¶ Not currently called, but should be provided for future compatibility.
-
validate_comment
(comment)¶ Validate ticket comment.
Must return a list of messages, one for each problem detected. The return value
[]
indicates no problems.Since: 1.3.2
-
-
class
trac.ticket.api.
TicketFieldList
(*args)¶ Bases:
list
Improved ticket field list, allowing access by name.