From 5c5d60aa635fe90537e137c20d7619c03c30f12e Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 1 Jun 2006 03:57:07 +0000 Subject: [PATCH] Fixed #411 -- CursorDebugWrapper now supports pyformat paramstyle git-svn-id: http://code.djangoproject.com/svn/django/trunk@3038 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django/db/backends/util.py b/django/db/backends/util.py index b9c6f573c9..3098a53556 100644 --- a/django/db/backends/util.py +++ b/django/db/backends/util.py @@ -12,6 +12,10 @@ class CursorDebugWrapper: return self.cursor.execute(sql, params) finally: stop = time() + # If params was a list, convert it to a tuple, because string + # formatting with '%' only works with tuples or dicts. + if not isinstance(params, (tuple, dict)): + params = tuple(params) self.db.queries.append({ 'sql': sql % tuple(params), 'time': "%.3f" % (stop - start),