Extension Point : IMilestoneChangeListener
Interface | IMilestoneChangeListener | Since | 0.12 |
Module | trac.ticket.api | Source | api.py |
The IMilestoneChangeListener allows components to listen for and to react to milestone events.
Purpose
The Trac milestone system helps planning and managing the future development of a project. Plugins can hook into the milestone system to trigger their own actions when milestones are created, deleted or changed.
The main purpose for this interface is to allow plugins to stay informed about the existing milestones and trigger appropriate actions elsewhere (e.g. sending notifications, starting indexing services, updating supplementary data structures etc.)
Usage
Implementing the interface follows the standard guidelines found in TracDev/ComponentArchitecture and of course TracDev/PluginDevelopment.
When a user creates a new milestone the milestone_created
method is called. Similarly methods are called when a user deletes a milestone (milestone_deleted
) or changes some milestone properties (milestone_changed
).
The milestone model object is passed to each handler. So the milestone properties can be accessed as usual (i.e. milestone.name
, milestone.due
, milestone.completed
, milestone.description
) and the milestone can be updated etc.
In milestone_changed
the changed properties are available by indexing e.g. old_values['name']
.
Examples
See MilestoneToVersion sample plugin.
Available Implementations
- MilestoneToVersion sample plugin
Additional Information and References
- epydoc
- API Reference
- See trac.ticket.api.ITicketChangeListener, trac.versioncontrol.api.IRepositoryChangeListener, trac.attachment.IAttachmentChangeListener, trac.wiki.api.IWikiChangeListener
- Milestone database schema
- Related tickets:
- Generic change listener replacement: #8834, #11148, #6543, Trac-dev:7737
- This interface has also been implemented twice before in a branch but got removed before merging.
API History
- 0.12 introduced the interface (changeset:8828, #6543)