P4DTI issue job000842

TitlePython 2.3 or 2.3.x breaks Bugzilla integration
Statusclosed
Prioritycritical
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionUnder Python 2.3 or 2.3.x, the Bugzilla integration fails with this message: "Bugzilla database error: (P4DTI-1058) Given 'True' when expecting a string or integer."
Here is a traceback:
 File "/home/nb/info.ravenbrook.com/project/p4dti/version/2.1/test/test_p4dti.py", line 2321, in runTest
   self.r.migrate()
 File "replicator.py", line 828, in migrate
   self.replicate_fixes_p4_to_dt(issue, job)
 File "replicator.py", line 1791, in replicate_fixes_p4_to_dt
   self.replicate_changelist_p4_to_dt(changelist)
 File "replicator.py", line 1264, in replicate_changelist_p4_to_dt
   description, status, user):
 File "dt_bugzilla.py", line 875, in replicate_changelist
   self.bugzilla.add_changelist(dt_changelist)
 File "bugzilla.py", line 1492, in add_changelist
   self.insert_row_rid_sid('p4dti_changelists', dict)
 File "bugzilla.py", line 545, in insert_row_rid_sid
   self.insert_row(table, dict)
 File "bugzilla.py", line 527, in insert_row
   value = self.quote(table, key, dict[key])
 File "bugzilla.py", line 346, in quote
   return self.sqlquote(value)
 File "bugzilla.py", line 307, in sqlquote
   raise error, catalog.msg(105, str(value))
Bugzilla database error: (P4DTI-1058) Given 'True' when expecting a string or integer.
AnalysisBooleans now have their own type, so if value is a boolean, type(value) is no longer types.IntType; we use this test when turning values into SQL. We should use isinstance(value, types.IntType) instead (because types.BooleanType is still a subtype of types.IntType) and also we shouldn't pass booleans around when what we really want is 1 or 0 (for a SQL column). For any value x, the expression ((x and 0) or 1) is 1 or 0 according to whether x tests true or false.
How foundcustomer
Evidence<http://info.ravenbrook.com/mail/2004/01/06/22-20-02/0.txt>
<http://info.ravenbrook.com/mail/2004/01/06/22-40-53/0.txt>
Observed in2.1.1
Introduced in2.1.0
Test proceduretest_p4dti.migrate tests this.
Created byNick Barnes
Created on2004-01-07 17:11:16
Last modified byNick Barnes
Last modified on2004-01-07 17:15:45
History2004-01-07 NB Created.

Fixes

Change Effect Date User Description
71879 closed 2004-01-07 17:15:32 Nick Barnes Make P4DTI work with Python 2.3.x