Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

0.91-bugfixes: Fixed #4651; UnicodeCursorWrapper should work with dic…

…tionaries of parameters now

git-svn-id: http://code.djangoproject.com/svn/django/branches/0.91-bugfixes@5508 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 17e98808c190d1dae03f09d9fd544f698662d3e9 1 parent 1680e87
@ubernostrum ubernostrum authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 django/core/db/backends/postgresql.py
View
13 django/core/db/backends/postgresql.py
@@ -36,10 +36,19 @@ def __init__(self, cursor, charset):
self.charset = charset
def execute(self, sql, params=()):
- return self.cursor.execute(sql, [smart_basestring(p, self.charset) for p in params])
+ try:
+ params = dict([(k, smart_basestring(v, self.charset)) for (k, v) in params.items()])
+ except AttributeError:
+ params = [smart_basestring(p, self.charset) for p in params]
+ return self.cursor.execute(sql, params)
def executemany(self, sql, param_list):
- new_param_list = [tuple([smart_basestring(p, self.charset) for p in params]) for params in param_list]
+ try:
+ new_param_list = [dict([(k, smart_basestring(v, self.charset)) for (k, v) in params.items()])
+ for params in param_list]
+ except AttributeError:
+ new_param_list = [tuple([smart_basestring(p, self.charset) for p in params])
+ for params in param_list]
return self.cursor.executemany(sql, new_param_list)
def __getattr__(self, attr):
Please sign in to comment.
Something went wrong with that request. Please try again.