On Oct 3, 7:53 pm, "Erik Bray" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 3, 2008 at 12:56 PM, sfx <[EMAIL PROTECTED]> wrote:
>
> > Hi, I tried this method, and does work ( a bit).
> > Now I can not figure out why I can not insert values into
> > ticket_custom table.
> > Values go fine into ticket table and do appear fine in browser but
> > nothing gets inserted into ticket_custom. I do not get any error or
> > any warning when I insert into ticket_custom, but the data gets lost,
> > and nothing appears.
> > any idea whats going on ?
> > Regards
>
> Can't say without seeing your code.  You insert stuff into
> ticket_custom the same way you would insert into any other table.  Are
> you sure nothing's going into the database?  Are you committing the db
> changes?
>
> Really though, you shouldn't have to directly access the DB to do this
> at all.  Instead, take the fields parsed out of your bugtracker and
> create ticket objects.  Like so:
>
> from trac.env import open_environment
> from trac.ticket.model import Ticket
>
> env = open_environment('/path/to/trac/env')
> db = env.get_db_cnx()
> for old_ticket in old_tickets:
>     ticket = Ticket(env)
>     for field, value in old_ticket.iteritems():
>         ticket[field] = value
>     ticket.insert(db)
> db.commit()
>
> This assumes that your old bugtracker tickets are in a list of
> dictionaries called old_tickets where each item is a dictionary of
> field/value pairs.

I am doing some thing very similar, by parsing the values one by one
for each table, and then inserting into table, and table_custom.
I think its some thing wrong with commit. I ll go through it again.

PS: my second question in original mail was
[Another question arises is that the priority in legacy Ms Access db
is
'High,Normal,Low'. So I want to change the trac's priority drop down
values to ones in access db.]

Ans: I achieved this my changing the enum table, and updating the
priority values. now it gives me exact drop down options what I want.
I hope there is no drawback for this approach.

I ll update in case I run into troubles...
Regards
Kazz

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to