Opened 18 years ago
Closed 18 years ago
#2913 closed defect (fixed)
[patch] Logic error re sql param interpolation in CursorDebugWrapper.execute
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 0.95 |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The relevant code, inside db/backends/util.py, is as follows:
if not isinstance(params, (tuple, dict)): params = tuple(params) self.db.queries.append({ 'sql': sql % tuple(params), 'time': "%.3f" % (stop - start), })
The second instance in that code of converting params into a tuple is erroneous (if params is a dictionary, it should not be converted into a tuple). As a result, string interpolation using the %(name)s syntax fails in debug mode.
Attachments (1)
Change History (3)
by , 18 years ago
comment:1 by , 18 years ago
Summary: | Logic error re sql param interpolation in CursorDebugWrapper.execute → [patch] Logic error re sql param interpolation in CursorDebugWrapper.execute |
---|
Changing subject to reflect the existence of a patch
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Patch for util.py