Opened 8 years ago
Closed 5 years ago
#12547 closed defect (wontfix)
cursor.execute() requires list or tuple for 2nd argument in bugzilla2trac.py
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | contrib | Version: | |
Severity: | normal | Keywords: | bugzilla2trac |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I noticed this issue while reading r15012.
>>> import MySQLdb >>> conn = MySQLdb.connect(user='root') >>> cursor = conn.cursor() >>> cursor.execute('SELECT %s', 'blah') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/venv/py25/lib/python2.5/site-packages/MySQLdb/cursors.py", line 187, in execute query = query % tuple([db.literal(item) for item in args]) TypeError: not all arguments converted during string formatting >>> cursor.execute('SELECT %s', ['blah']) 1L >>> list(cursor) [('blah',)]
I think the following code should use a list and bugzilla2trac.py
currently doesn't work….
def getLoginName(self, cursor, userid): if userid not in self.loginNameCache: - cursor.execute("SELECT * FROM profiles WHERE userid = %s", (userid)) + cursor.execute("SELECT * FROM profiles WHERE userid = %s", + [userid]) loginName = cursor.fetchall()
Untested patch: bugzilla2trac.diff.
Attachments (1)
Change History (6)
by , 8 years ago
Attachment: | bugzilla2trac.diff added |
---|
comment:1 by , 8 years ago
Keywords: | bugzilla2trac added |
---|
comment:2 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:5 by , 5 years ago
Milestone: | next-stable-1.2.x |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
bugzilla2trac.py
is no longer maintainer by Trac developers and is being deleted from the trunk. If you need the plugin, please consider copying it from 1.4-stable and creating a plugin on trac-hacks.org.
I think it would be a good idea to just go ahead and commit this since it looks like the script is completely broken. From the other open tickets it looks like there is a lot of work to do on bugzilla2trac and we could fix other problems later.
Also, we could use a tuple rather than list,
(fieldid,)
, which seems to be the more common style used throughout the Trac codebase.