Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#449 closed defect (duplicate)

KeyError: 'id'

Reported by: anonymous Owned by: Bas van der Vlies
Priority: normal Component: EmailtoTracScript
Severity: normal Keywords:
Cc: Trac Release: 0.9


I have encountered the following errors.

TD: saving email to /var/tmp/msg.txt
TD: multipart container
TD: part1: Content-Type: text/plain
TD: part1: filename: None
TD: this part is not multipart
TD: writing part1 (/var/tmp/part1)
TD: part2: Content-Type: text/plain
TD: part2: filename: attachutf-8.txt
TD: this part is not multipart
TD: writing part2 (/var/tmp/part2)
Traceback (most recent call last):
  File "/home/fedora/tamura/ports/email2trac-0.7/email2trac", line 765, in ?
  File "/home/fedora/tamura/ports/email2trac-0.7/email2trac", line 467, in parse
    if self.ticket_update(m):
  File "/home/fedora/tamura/ports/email2trac-0.7/email2trac", line 356, in ticket_update
    self.attachments(m, tkt)
  File "/home/fedora/tamura/ports/email2trac-0.7/email2trac", line 641, in attachments
    att = attachment.Attachment(self.env, 'ticket', ticket['id'])
  File "/usr/lib/python2.4/site-packages/trac/ticket/", line 97, in __getitem__
    return self.values[name]
KeyError: 'id'

It might fix with following patch.

*** 352,358 ****
                        tkt = Ticket(self.env, ticket_id, self.db)
                        tkt.save_changes(, body_text, when)
+               tkt['id'] = ticket_id

                self.attachments(m, tkt)

Attachments (0)

Change History (4)

comment:1 Changed 17 years ago by Bas van der Vlies

Resolution: duplicate
Status: newclosed

This can be a solution, but it is strange that the 'id' field is not filled in when we try to fetch an existing ticket can yoo try to add some debug statements to ticket_update function. See ticket #258 (same ticket)

comment:2 Changed 17 years ago by anonymous

i think it doesn't set 'id' in method _fetch_ticket on Ticket.

it because of method get_ticket_fields() on TicketSystem doesn't return 'name':'id'.

What we can do is that hack the class Ticket or change the


comment:3 Changed 17 years ago by anonymous

Thanks for the info. In the 0.8 releasae the id is set in _fetch_ticket_fields. That drop that in 0.9 and higher versions. So or it is a bug or we patch email2trac with the patch you provided. Can you sent me your name then i give you the credits ;-)

comment:4 Changed 17 years ago by anonymous

Applied patch to trunk for trac version greater then 0.8, see #258

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Bas van der Vlies.
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.