Opened 18 years ago
Last modified 8 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: | |||
| Internal Changes: | |||
Description (last modified by )
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:
…becomes…
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 , 18 years ago
comment:3 by , 17 years ago
| Cc: | added | 
|---|
Seems like this makes a lot of sense.
Another example
close = *,!closed -> closed
Could it be scheduled a bit sooner than 1.0?
comment:6 by , 15 years ago
| Cc: | added | 
|---|
#9547 was duplicate of this ticket; adding that reporter to this ticket.
comment:8 by , 10 years ago
| Owner: | removed | 
|---|
comment:9 by , 10 years ago
| Keywords: | patch added | 
|---|
comment:10 by , 8 years ago
| Description: | modified (diff) | 
|---|
comment:11 by , 8 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 exceptoldstate1,oldstate2oldstate1,oldstate2 -> newstate: a transition fromoldstate1,oldstate2



  
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:
added some brainstorming at the bottom of TracWorkflow. see also #5865.