On Wed, Aug 29, 2007 at 10:18:46AM +0300, Eugeny N Dzhurinsky wrote: > Hello there! > > We're trying to evaluate Trac to switch to it from existing bugzilla issue > tracking system, however for some reason import script fails: > > 7. Import bugs and bug activity... > inserting ticket 1 -- Chart type dropdown > Traceback (most recent call last): > File "bugzilla2trac.py", line 885, in ? > main() > File "bugzilla2trac.py", line 882, in main > convert(BZ_DB, BZ_HOST, BZ_USER, BZ_PASSWORD, TRAC_ENV, TRAC_CLEAN) > File "bugzilla2trac.py", line 806, in convert > ticketid = trac.addTicket(**ticket) > File "bugzilla2trac.py", line 348, in addTicket > lastId=self.db().get_last_id(c, 'ticket') > File "/usr/lib64/python2.4/site-packages/trac/db/postgres_backend.py", line > 146, in get_last_id > cursor.execute("SELECT CURRVAL('%s_%s_seq')" % (table, column)) > File "/usr/lib64/python2.4/site-packages/trac/db/util.py", line 51, in > execute > return self.cursor.execute(sql) > File "/usr/lib64/python2.4/site-packages/trac/db/util.py", line 51, in > execute > return self.cursor.execute(sql) > psycopg2.ProgrammingError: currval of sequence "ticket_id_seq" is not yet > defined in this session > > Could somebody please advice?
After some investigation I found the line return self.db().get_last_id(c, 'ticket') should be replaced with return id ===================== --- bugzilla2trac.py.orig 2007-04-20 15:41:52.000000000 +0200 +++ bugzilla2trac.py 2007-08-29 10:14:51.000000000 +0200 @@ -344,9 +344,9 @@ reporter, cc, version, milestone.encode('utf-8'), status.lower(), resolution, summary.encode('utf-8'), desc, keywords)) - + self.db().commit() - return self.db().get_last_id(c, 'ticket') + return id def addTicketComment(self, ticket, time, author, value): comment = value.encode('utf-8') ==================== but now I'm getting really strange error when importing attachment for issues: Traceback (most recent call last): File "bugzilla2trac.py", line 883, in ? main() File "bugzilla2trac.py", line 880, in main convert(BZ_DB, BZ_HOST, BZ_USER, BZ_PASSWORD, TRAC_ENV, TRAC_CLEAN) File "bugzilla2trac.py", line 810, in convert trac.addAttachment(author, a) File "bugzilla2trac.py", line 398, in addAttachment filedata = StringIO.StringIO(a['thedata'].tostring()) KeyError: 'thedata' Probably somebody knows why is that and how to fix, I'm not python guru ;) -- Eugene N Dzhurinsky
pgpDMrh5ae94c.pgp
Description: PGP signature