Modify

Opened 6 years ago

Closed 6 years ago

#13435 closed defect (fixed)

KIS plugin does not differentiate between <none> and new state

Reported by: solstice333 Owned by: Jon Ashley
Priority: highest Component: KeepInterfaceSimplePlugin
Severity: critical Keywords:
Cc: Trac Release: 1.2

Description

In my ticket workflow, I have it so that at ticket creation, the state of the ticket is <none>. Once the ticket is created, the state is new. When I configure [kis_assistant] to have cc.visible = status != 'new', it hides the cc field for both creation of the ticket and the ticket being in the new state. Conversely, when I configure [kis_assistant] to have cc.visible = status != '<none>', the field is not hidden at all. Ultimately, I just want to hide the cc field at ticket creation, which is what I expect from cc.visible = status != '<none>'.

Attachments (0)

Change History (10)

comment:1 Changed 6 years ago by Jon Ashley

Could you post the [ticket-workflow] section of your configuration file (or a stripped-down version of the workflow that shows the same problem)?

I was under the impression that "new" was a built-in state in Trac, but I could easily be wrong about that.

As a temporary workaround, I suggest creating a user-defined function that returns the ticket creation state. Create a file named something like CreateState.py with the following content:

from trac.core import *
from kis2 import IConfigFunction

class CreateState(Component):
   implements(IConfigFunction)

   def at_creation(self, req):
      return req.args['id'] == 'null'

and put it in your plugins folder along with kisplugin. After restarting the server, you should have a new CreateState plugin available. Enable that new plugin in the Trac admin panel. This will make a function at_creation available to the trac.ini kis configuration that returns True if the ticket is at ticket creation, so that you can write cc.visible = !at_creation() in the configuration file.

I have not tested this very much, so please let me know if it works for you.

comment:2 in reply to:  1 Changed 6 years ago by Ryan J Ollos

Replying to Jon Ashley:

I was under the impression that "new" was a built-in state in Trac, but I could easily be wrong about that.

new is no longer a required state in Trac 1.2: TracWorkflow#TicketCreateAction. The ticket lifecycle begins with <none> (prior to creation of a ticket) and ends with closed.

The <none> workflow state was introduced to give control over the workflow when creating a ticket, and to avoid hacks like TicketCreationStatusPlugin. While the ticket status field will not have value <none>, I'm pretty sure you'll find ticket['status'] is None.

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

comment:3 Changed 6 years ago by Ryan J Ollos

Trac Release: 1.2

comment:4 Changed 6 years ago by solstice333

Cool, thanks for pointing me in the right direction. I dumped out the req.args to a file and saw what req.args['id'] was. The following works:

from trac.core import *
from kis2 import IConfigFunction

class CreateState(Component):
   implements(IConfigFunction)

   def at_creation(self, req):
      return not req.args['id'] # req.args['id'] evals to an empty unicode string

comment:5 Changed 6 years ago by Jon Ashley

In 17184:

Status should evaluate as the empty string when the ticket has not yet been created; re #13435

comment:6 Changed 6 years ago by Ryan J Ollos

Summary: KIS plugin does not differntiate between <none> and new stateKIS plugin does not differentiate between <none> and new state

comment:7 Changed 6 years ago by Jon Ashley

Status: newaccepted

I think the change in [17184] should fix the issue. status will now evaluate to an empty string when at ticket creation.

I've tested this on Trac 1.0.9 and Trac 1.2, both of which showed the fault previously. Can you please confirm that this works for you before I close this ticket and create a new release?

comment:8 Changed 6 years ago by solstice333

Finally got around to testing this out. Yes, it works.

comment:9 Changed 6 years ago by Jon Ashley

In 17194:

Update documentation prior to release; re #13435

comment:10 Changed 6 years ago by Jon Ashley

Resolution: fixed
Status: acceptedclosed

In 17195:

Replace release 2.3 with 2.4. This fixes #13435 and removes the deprecated ITemplateStreamFilter interface.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jon Ashley.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.