Index: base.py
===================================================================
--- base.py	(revision 4347)
+++ base.py	(working copy)
@@ -25,6 +25,15 @@
         return s.encode(charset)
     return s
 
+def smart_formatobj(o, charset):
+    if isinstance(o, dict):
+        def reduction(encoded_dct, key):
+            encoded_dct[key] = smart_basestring(o[key], charset)
+            return encoded_dct
+        return reduce(reduction, o, {})
+    else:
+        return [smart_basestring(param, charset) for param in o]
+
 class UnicodeCursorWrapper(object):
     """
     A thin wrapper around psycopg cursors that allows them to accept Unicode
@@ -40,10 +49,10 @@
         self.charset = charset
 
     def execute(self, sql, params=()):
-        return self.cursor.execute(sql, [smart_basestring(p, self.charset) for p in params])
+        return self.cursor.execute(sql, smart_formatobj(params, self.charset))
 
     def executemany(self, sql, param_list):
-        new_param_list = [tuple([smart_basestring(p, self.charset) for p in params]) for params in param_list]
+        new_param_list = [tuple(smart_formatobj(params, self.charset)) for params in param_list]
         return self.cursor.executemany(sql, new_param_list)
 
     def __getattr__(self, attr):
