[TRAC] add ticket with php page

10 views
Skip to first unread message

Aquaserver

unread,
Jul 11, 2008, 4:53:47 AM7/11/08
to trac-...@googlegroups.com
Hello,
I would like to add ticket in trac without use trac interface.
I don't know if it's possible but I want to use php for do that.
I anyone have an idea :)

Thank you


Jani Tiainen

unread,
Jul 11, 2008, 5:32:42 AM7/11/08
to trac-...@googlegroups.com
Aquaserver kirjoitti:

xml-rpc or try using one of those patches providing json-calls on top of
xml-rpc plugin.

--
Jani Tiainen

Eleonore DUVELLE

unread,
Jul 11, 2008, 5:40:33 AM7/11/08
to trac-...@googlegroups.com
I know how to do it in Python, but not in PHP. Anyway, I think that the only way is to write directly in the database. This page might be of some help: http://trac.edgewall.org/wiki/TracDev/DatabaseSchema
Maybe if you described more what you want I could give you some more info. Do you want to create tickets directly or export them from another soft?

Good luck!

Eleonore


-----Message d'origine-----
De : trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] De la part de Aquaserver
Envoyé : vendredi 11 juillet 2008 10:54
À : trac-...@googlegroups.com
Objet : [Trac] add ticket with php page


Hello,
I would like to add ticket in trac without use trac interface.
I don't know if it's possible but I want to use php for do that.
I anyone have an idea :)

Thank you


Jani Tiainen

unread,
Jul 11, 2008, 5:43:53 AM7/11/08
to trac-...@googlegroups.com
Eleonore DUVELLE kirjoitti:

> I know how to do it in Python, but not in PHP. Anyway, I think that the only way is to write directly in the database. This page might be of some help: http://trac.edgewall.org/wiki/TracDev/DatabaseSchema
> Maybe if you described more what you want I could give you some more info. Do you want to create tickets directly or export them from another soft?
>

I would ever access Trac database directly. (Exception to plugin that
creates own tables). There is lot of under hood logic that will get
bypassed if you access database directly. For example taking care of
change history, notifications etc.

--
Jani Tiainen

Emmanuel Blot

unread,
Jul 11, 2008, 5:44:45 AM7/11/08
to trac-...@googlegroups.com
> I know how to do it in Python, but not in PHP. Anyway, I think that the only way is to write directly in the database.

Nope, there is the XMLRPC plugin which should always be preferred over
hacking into the database directly.

Be careful when accessing the DB bypassing a Trac API: this is very
error prone, especially for character encoding issues: you may end up
setting invalid characters into the DB, which can become a true
nightmare to debug and fix.

Cheers,
Manu

Emmanuel Blot

unread,
Jul 11, 2008, 5:45:43 AM7/11/08
to trac-...@googlegroups.com
> I would ever access Trac database directly.

+"n" ;-)

Cheers,
Manu

Eleonore DUVELLE

unread,
Jul 11, 2008, 5:53:33 AM7/11/08
to trac-...@googlegroups.com
That's right, of course. But in our case, we don't use email notifications, and the change history takes into accout the changes I do in the database. (I don't know how, but it does). I've made a program that creates tickets in Trac by modifying its database and I've encountered no problem yet.
Could you tell me witch other things have to be taken care of, except from the change history and the notifications?

-----Message d'origine-----
De : trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] De la part de Jani Tiainen
Envoyé : vendredi 11 juillet 2008 11:44
À : trac-...@googlegroups.com
Objet : [Trac] Re: add ticket with php page

Aquaserver

unread,
Jul 11, 2008, 5:49:25 AM7/11/08
to trac-...@googlegroups.com
Actually I have a page of support where user can post their problems.
I would like when a user add a problem a ticket will be create
automatically in trac

On 11 juil. 2008, at 11:40, Eleonore DUVELLE wrote:

>
> I know how to do it in Python, but not in PHP. Anyway, I think that
> the only way is to write directly in the database. This page might
> be of some help: http://trac.edgewall.org/wiki/TracDev/DatabaseSchema
> Maybe if you described more what you want I could give you some more
> info. Do you want to create tickets directly or export them from
> another soft?
>
> Good luck!
>
> Eleonore
>
>
> -----Message d'origine-----
> De : trac-...@googlegroups.com [mailto:trac-

> us...@googlegroups.com] De la part de Aquaserver

Emmanuel Blot

unread,
Jul 11, 2008, 7:15:53 AM7/11/08
to trac-...@googlegroups.com
> Could you tell me witch other things have to be taken care of, except from the change history and the notifications?

Consider the reverse way: if you can implement the same features with
XMLRPC, do not hack the database.

As I wrote, if you ever write a non-UTF-8 character in the DB, the
error may remain silent for weeks, and sometimes later prevent from
accessing a ticket or even prevent from running any report or query in
the future, for example.

Cheers
Manu

Eleonore DUVELLE

unread,
Jul 11, 2008, 8:56:47 AM7/11/08
to trac-...@googlegroups.com
Yes, I've taken care of that too with my Python program (our tickets are in French so it would have been impossible not to use utf-8). But if there are other problems with creating tickets into the Trac database, I'd like to know them... My program is already created and used, so I can't use xml-rpc.

-----Message d'origine-----
De : trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] De la part de Emmanuel Blot
Envoyé : vendredi 11 juillet 2008 13:16
À : trac-...@googlegroups.com
Objet : [Trac] Re: add ticket with php page

Jani Tiainen

unread,
Jul 11, 2008, 1:41:58 PM7/11/08
to trac-...@googlegroups.com
Eleonore DUVELLE kirjoitti:

> Yes, I've taken care of that too with my Python program (our tickets are in French so it would have been impossible not to use utf-8). But if there are other problems with creating tickets into the Trac database, I'd like to know them... My program is already created and used, so I can't use xml-rpc.

Problems are much like modfying sqlite database directly as a binary
file not through sqlite libraries - it will work for a while. Schema
might change without notification since it's not intended to be modified
directly.

But what if DB schema changes? What if there is plugin that relies on
ITicketChangeListener interface?

All that get's bypassed. Also, you're bypassing lot of built-in
security. Trac is pretty secure against attacks since it's tested by
many, but how about yours?

So it is very preferable to use Trac API to manage Trac data. If you're
working with Python you can use Ticket API directly, but don't bypass it.

Like I wrote in the beginning, why are you using sqlite libraries to
access database. It's a binary file (format known). Why don't you write
and read it directly without any libraries?

This is the point - Using Trac API can make program work much longer and
with much more variety of environments.

Happy hacking.

--

Jani Tiainen

tleathe...@googlemail.com

unread,
Jul 12, 2008, 6:10:33 AM7/12/08
to Trac Users
Emmuel Blot,

thank for the information!
I ask around permission for being allowed to follow that...

Regards
TPEslave

Eleonore DUVELLE

unread,
Jul 15, 2008, 3:19:14 AM7/15/08
to trac-...@googlegroups.com
You're right, it would be better if I used the Trac API whith my Python program. The problem is that I've searched - and even posted a mail on this list- but I can't find any document that explains how Trac works, which classes/functions are used to create tickets, etc. So I don't know what I must call and with which arguments in order to create a new ticket. Maybe someone can help me with this?

As it is surely better that doing it with pysqlite, I would be glad to do it this way.

As for your question :

" Like I wrote in the beginning, why are you using sqlite libraries to
access database. It's a binary file (format known). Why don't you write
and read it directly without any libraries?"

I simply didn't know there was another way to modify a database without SQLite. In fact, I'm quite new to programming so I guess there are a lot of things which seem clear to programmers but that I don't even know of.

Thanks for your answer,

Eleonore.

-----Message d'origine-----
De : trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] De la part de Jani Tiainen
Envoyé : vendredi 11 juillet 2008 19:42


À : trac-...@googlegroups.com
Objet : [Trac] Re: add ticket with php page

Noah Kantrowitz

unread,
Jul 15, 2008, 3:35:31 AM7/15/08
to trac-...@googlegroups.com
Eleonore DUVELLE wrote:
> You're right, it would be better if I used the Trac API whith my Python program. The problem is that I've searched - and even posted a mail on this list- but I can't find any document that explains how Trac works, which classes/functions are used to create tickets, etc. So I don't know what I must call and with which arguments in order to create a new ticket. Maybe someone can help me with this?
>
> As it is surely better that doing it with pysqlite, I would be glad to do it this way.
>
> As for your question :
> " Like I wrote in the beginning, why are you using sqlite libraries to
> access database. It's a binary file (format known). Why don't you write
> and read it directly without any libraries?"
>
> I simply didn't know there was another way to modify a database without SQLite. In fact, I'm quite new to programming so I guess there are a lot of things which seem clear to programmers but that I don't even know of.
>
> Thanks for your answer,

This is one of the very few things that is actually documented:
http://trac.edgewall.org/wiki/TracDev/DataModels

--Noah

signature.asc

Eleonore DUVELLE

unread,
Jul 15, 2008, 3:41:30 AM7/15/08
to trac-...@googlegroups.com
Thanks, that's exactly what I needed!

-----Message d'origine-----
De : trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] De la part de Noah Kantrowitz
Envoyé : mardi 15 juillet 2008 09:36


À : trac-...@googlegroups.com
Objet : [Trac] Re: add ticket with php page

Eleonore DUVELLE wrote:

Reply all
Reply to author
Forward
0 new messages