On Saturday, December 17, 2016 at 12:32:40 PM UTC-8, Theodor Norup wrote:
>
> I am maintaining a plugin (SubticketsPlugin) that has configuration values
> that are per-ticket-type. I'd like to improve the plugin to use the Options
> interface so that its configuration becomes editable through the IniAdmin
> plugin.
>
What values will you be storing in trac.ini? Are the values currently
stored in the database?
> However, to do that properly, first of all I need to enumerate all
> available ticket types and I cannot find an api function for that.
>
Here's an example:
>>> from trac.env import Environment
>>> from trac.ticket.model import Type as TicketType
>>> env =
Environment('/Users/rjollos/Documents/Workspace/trac-dev/tracenvs/proj-1.0')
>>> for t in TicketType.select(env):
... print(t.name, t.value)
...
(u'defect', u'1')
(u'enhancement', u'2')
(u'task', u'3')
> Secondly, I need to detect addition of new ticket types. Had there been an
> extension point like the IMilestoneChangeListener it had been easy...
>
> Suggestions on alternative ways to proceed are very welcome. Other plugins
> with per-ticket-type configuration could benefit too.
>
> BTW, I'm aware of the discussion in https://trac.edgewall.org/ticket/11148
> <https://www.google.com/url?q=https%3A%2F%2Ftrac.edgewall.org%2Fticket%2F11148&sa=D&sntz=1&usg=AFQjCNH52C67SdMwxOIqdhUDqmgAiuRuoA>
>
> which suggests the future existence of an ITypeChangeListener interface,
> but unfortunately that has not been integrated in the main line.
>
Yeah #11148 is sorely needed, and revisiting that is high on my priority
list.
For now, I think you'll have to use IRequestFilter:
https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter
That won't notify you in the case that the Ticket Type is added using
trac-admin. I don't see a way to handle that scenario, short of
implementing #11148.
> Thanks in advance.
>
> T.
>
- Ryan
--
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.