Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10553 closed enhancement (fixed)

[PATCH] Additional milestone operation for sample-plugins

Reported by: framay <franz.mayer@…> Owned by: framay <franz.mayer@…>
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)

MilestoneOperation.py (4.1 KB ) - added by framay <franz.mayer@…> 12 years ago.
Plugin file for set_milestone operation
MilestoneOperation.2.py (4.6 KB ) - added by framay <franz.mayer@…> 12 years ago.
improved version of component MilestoneOperation

Download all attachments as: .zip

Change History (7)

by framay <franz.mayer@…>, 12 years ago

Attachment: MilestoneOperation.py added

Plugin file for set_milestone operation

comment:1 by Christian Boos, 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 framay <franz.mayer@…>, 12 years ago

Attachment: MilestoneOperation.2.py added

improved version of component MilestoneOperation

in reply to:  1 comment:2 by framay <franz.mayer@…>, 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 Christian Boos, 12 years ago

Milestone: next-dev-1.1.x1.0
Resolution: fixed
Status: newclosed

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) but k in dict or even dict.get(k) when appropriate; test against None with is/is not None
  • in render_ticket_action_control, status was used when this was actually about resolutions
  • 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 Christian Boos, 12 years ago

Owner: set to framay <franz.mayer@…>

comment:5 by Christian Boos, 12 years ago

Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framay <franz.mayer@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from framay <franz.mayer@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.