Edgewall Software

Opened 13 years ago

Last modified 3 years ago

#5866 new enhancement

[patch] Workflow tweak: handle "not-state" transition specifications

Reported by: Morris Owned by:
Priority: low Milestone: unscheduled
Component: ticket system Version: devel
Severity: normal Keywords: patch workflow state
Cc: gt4329b@…, jevans, kace25_2000@… Branch:
Release Notes:
API Changes:

Description (last modified by Ryan J Ollos)

I found myself wanting things like this in my [ticket-workflow]:

reassign = * -> * 
reassign.operations = set_owner,leave_status 
reassign.permissions = TICKET_MODIFY 

needinfo = * -> needinfo 
needinfo.name = need info 
needinfo.operations = set_owner 
needinfo.permissions = TICKET_MODIFY

…but this would create two action options for a ticket in the "needinfo" state: "reassign and leave as needinfo", and "assign to new owner and leave as needinfo" …which are of course the same thing. I wanted to be able to do this instead:

needinfo = *,!needinfo -> needinfo 
needinfo.name = need info 
needinfo.operations = set_owner 
needinfo.permissions = TICKET_MODIFY

This would indicate that the "needinfo" state was a valid next state from every other state except "needinfo". To make this work, make the following tweak to /trac/ticket/default_workflow.py (line 161):

 if oldstates == ['*'] or status in oldstates:


 if ('*' in oldstates or status in oldstates) and ("!%s"%status not in oldstates):

I haven't tested this extensively, and even though it should be backwards-compatible… use with extra initial scrutiny.

Attachments (0)

Change History (10)

comment:1 by ThurnerRupert, 13 years ago

hmm … would it be possible to extend it more "workflow like" (http://wfmc.org)?

i.e., currently operations exist for the arrows. the other possibility wuold be to have operations on the nodes:

  • automatically executed preops (before entering the node)
  • automatically executed postops (before leaving the node)
  • choosable actions (possible when in the node), like "set_owner"

added some brainstorming at the bottom of TracWorkflow. see also #5865.

comment:2 by Remy Blank, 11 years ago

Milestone: 1.0

Interesting idea.

comment:3 by jevans, 11 years ago

Cc: jevans added

Seems like this makes a lot of sense.

Another example

close = *,!closed -> closed

Could it be scheduled a bit sooner than 1.0?

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:4 by Christian Boos, 10 years ago

Milestone: 1.0unscheduled

Milestone 1.0 deleted

comment:5 by Christian Boos, 9 years ago

Milestone: triagingunscheduled

Milestone triaging deleted

comment:6 by Eli Carter, 9 years ago

Cc: kace25_2000@… added

#9547 was duplicate of this ticket; adding that reporter to this ticket.

comment:8 by Ryan J Ollos, 5 years ago

Owner: Jonas Borgström removed

comment:9 by figaro, 4 years ago

Keywords: patch added

comment:10 by Ryan J Ollos, 3 years ago

Description: modified (diff)

comment:11 by Ryan J Ollos, 3 years ago

* implies all the set of all states, and !<state> is only needed to subtract from a set of all states. Therefore I think we could have !<state> imply all states except <state> (i.e. * - <state>). The following patterns would then be valid:

  • * -> newstate: a transition from all states
  • !oldstate1,!oldstate2 -> newstate: a transition from all states except oldstate1, oldstate2
  • oldstate1,oldstate2 -> newstate: a transition from oldstate1, oldstate2

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

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