diff -r bfff0679ea4c django/core/db/backends/postgresql.py
a
|
b
|
class UnicodeCursorWrapper(object):
|
36 | 36 | self.charset = charset |
37 | 37 | |
38 | 38 | def execute(self, sql, params=()): |
39 | | return self.cursor.execute(sql, [smart_basestring(p, self.charset) for p in params]) |
| 39 | try: |
| 40 | params = dict([(k, smart_basestring(v, self.charset)) for (k, v) in params.items()]) |
| 41 | except AttributeError: |
| 42 | params = [smart_basestring(p, self.charset) for p in params] |
| 43 | return self.cursor.execute(sql, params) |
40 | 44 | |
41 | 45 | def executemany(self, sql, param_list): |
42 | | new_param_list = [tuple([smart_basestring(p, self.charset) for p in params]) for params in param_list] |
| 46 | try: |
| 47 | new_param_list = [ |
| 48 | dict( |
| 49 | [(k, smart_basestring(v, self.charset)) for (k, v) in params.items()] |
| 50 | ) |
| 51 | for params in param_list |
| 52 | ] |
| 53 | except AttributeError: |
| 54 | new_param_list = [ |
| 55 | tuple( |
| 56 | [smart_basestring(p, self.charset) for p in params] |
| 57 | ) |
| 58 | for params in param_list |
| 59 | ] |
43 | 60 | return self.cursor.executemany(sql, new_param_list) |
44 | 61 | |
45 | 62 | def __getattr__(self, attr): |