#10553 closed enhancement (fixed)
[PATCH] Additional milestone operation for sample-plugins
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | contrib | Version: | |
Severity: | normal | Keywords: | patch workflow |
Cc: | Branch: | ||
Release Notes: |
Add MilestoneOperation sample plugin, a workflow operation which assign a ticket to a milestone for some specific resolution values |
||
API Changes: | |||
Internal Changes: |
Description
We have following workflow in my company:
If a ticket is rejected (which means not fixed / implemented) it will be moved to a milestone 'rejected'. Thus we have clean milestones with only implemented features / solved bug fixes.
It would be nice, if this could be parametrized using Trac workflow. I have implemented this in attached file MilestoneOperation.py
. Maybe the attached file could be committed in sample-plugins
, when there are no further comments regarding better / nicer implementation.
Plugin description:
Sets milestone for specific status.
Example
[ticket-workflow] resolve.operations = set_resolution,set_milestone resolve.milestone = invalid,wontfix,duplicate,worksforme->rejected
When setting status to duplicate
the milestone will automaitcally change
to rejected
.
Note: if user has changed milestone manually, this workflow operation has no effect!
Configuration
Don't forget to add MilestoneOperation
to the workflow option
in [ticket]
section. If there is no workflow option, the line will look
like this:
[ticket] workflow = ConfigurableTicketWorkflow,MilestoneOperation
Attachments (2)
Change History (7)
by , 13 years ago
Attachment: | MilestoneOperation.py added |
---|
follow-up: 2 comment:1 by , 12 years ago
Milestone: | → next-dev-1.1.x |
---|
Looks good, just found a typo: resoltions
.
Also, you should add the
revision = "$Rev$" url = "$URL$"
keys, and also author and author_email with your contact informations (same kind of policy as in contrib/
I'd say).
by , 12 years ago
Attachment: | MilestoneOperation.2.py added |
---|
improved version of component MilestoneOperation
comment:2 by , 12 years ago
Replying to cboos:
Looks good, just found a typo:
resoltions
.
Replaced resoltions
with resolutions
in method __get_resolution_milestone_dict
.
Also, you should add the
revision = "$Rev$" url = "$URL$"keys, and also author and author_email with your contact informations (same kind of policy as in
contrib/
I'd say).
Added licence info with author and author email as well as revision and url. Is this OK as I did it?
comment:3 by , 12 years ago
Milestone: | next-dev-1.1.x → 1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
I added MilestoneOperation.py
to trunk/sample-plugins/workflow in r11227.
While testing it I did the following changes:
- style: don't use
dict.has_key(k)
butk in dict
or evendict.get(k)
when appropriate; test againstNone
withis/is not None
- in
render_ticket_action_control
,status
was used when this was actually aboutresolutions
- the check for a Milestone existence was wrong… here's another victim of #4130 ;-)
A more subtle fix: if a milestone was set, and the ticket got reopened, then closing it again with a resolution which was not mapped would clear the milestone.
There's still a problem, not due to the plugin but rather to the well-known issue that we have trouble differentiating changes made by the user and changes made by the workflow: after an explicit "Preview" action, the new milestone set by the workflow becomes the "user defined" milestone, and as such it sticks. At least we have the "(revert)" action if needed, so it's not critical.
comment:4 by , 12 years ago
Owner: | set to |
---|
comment:5 by , 12 years ago
Release Notes: | modified (diff) |
---|
Plugin file for set_milestone operation