summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MySQLdb/cursors.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/MySQLdb/cursors.py b/MySQLdb/cursors.py
index 9797d4a..7c01870 100644
--- a/MySQLdb/cursors.py
+++ b/MySQLdb/cursors.py
@@ -240,7 +240,13 @@ class BaseCursor(object):
e = m.end(1)
qv = m.group(1)
try:
- q = [ qv % db.literal(a) for a in args ]
+ q = []
+ for a in args:
+ if isinstance(a, dict):
+ q.append(qv % dict((key, db.literal(item))
+ for key, item in a.iteritems()))
+ else:
+ q.append(qv % tuple([db.literal(item) for item in a]))
except TypeError, msg:
if msg.args[0] in ("not enough arguments for format string",
"not all arguments converted"):