Thanks to all of you for your help.
-Take a look at the AdvancedTicketWorkflow plugin
--> As chris said, Trac Workflow does not fire on creation of new tickets.
-you can roll your own by implementing the ITicketChangeListener interface.
--> That sounds really good.
I found this interface in
/usr/lib/python2.4/site-packages/Trac-0.11.3-py2.4.egg/trac/ticket/api.py
(why are all the trac files in the python dir?? Is that normal?).
In this file, I found the "class ITicketChangeListener(Interface)" and
inside it, there is the:
"def ticket_created(ticket):
Called when a ticket is created.".
So I guess I just have to subclass this interface and add my call to the
external script there.
(As I only need this external call for one project, I suppose I can't change
directly the file api.py. And that's not the right way to do it.)
I check the doc to see how to subclass this interface, but I must say I'm
lost.
Here is my attempt:
from trac.ticket import *
class ITicketChangeListener (Interface):
def ticket_created(ticket):
"""Called when a to-do item is added."""
subprocess.call(['ping', 'localhost'])
If that's correct, where do I put this (sub)class? In the plugins dir?
-write a listener plugin
--> Unfortunately, it's out of my competence. I don't know the Python
language. I check the plugin area and I won't be able to do it I think.
-Using mail notification, run a mailer daemon that fires off the
scripts. (maybe with the AnnouncerPlugin, or
TicketTeamDispatcherPlugin, might be a bit easier)
--> seems a bit too much for the purpose.
-use a bot that subscribes to the time-line rss and reacts that way.
(this is what I would do, personally)
--> seems a bit too much for the purpose
-depending on your database back end, use a db trigger
--> I thought of that but for now we are using sqlite as Db and it doesn't
have the trigger possibility. So I have to change to the postgress sql Db I
guess. But I would like to see if I can't find another solution first.
-There's probably a way to use xmlrpc as well.
--> ?? hmm.. heuu..hmmm.. (0_°)
-There might be a way to modify the genshi template to run a script on
submit, or modify the submit code directly (this would be ugly, and
hard to maintain, IMHO, but sometimes quick and dirty is the way to
go)
--> You're right and it can be a good idea as I only have to launch 1 script
in 1 case. I'll keep it in mind.
Kenny
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la
part de yoheeb
Envoyé : lundi 20 juillet 2009 20:13
À : Trac Users
Objet : [Trac] Re: call external script on new ticket
On Jul 17, 6:15 am, "oximoron" <[email protected]> wrote:
> Hello everyone,
>
> I searched the archives but didn't find any info about my problem.
>
> I would like to be able to call an external script (shell or perl or php)
> when a new ticket is created.
>
> I need that because we interact trac with several other softwares and I
need
> to update informations elsewhere when a new ticket is created.
>
> Can anyone tell me how to do that?
>
> Thank you
>
> Kenny
I can think of a few ways:
-write a listener plugin
-Using mail notification, run a mailer daemon that fires off the
scripts. (maybe with the AnnouncerPlugin, or
TicketTeamDispatcherPlugin, might be a bit easier)
-use a bot that subscribes to the time-line rss and reacts that way.
(this is what I would do, personally)
-depending on your database back end, use a db trigger
-There's probably a way to use xmlrpc as well.
-There might be a way to modify the genshi template to run a script on
submit, or modify the submit code directly (this would be ugly, and
hard to maintain, IMHO, but sometimes quick and dirty is the way to
go)
I bet someone has even more brilliant ideas.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---