From: <gha...@us...> - 2005-02-27 18:40:25
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14323/pyPgSQL Modified Files: PgSQL.py Log Message: 27FEB2005 gh Converted all checks for Unicode types to isinstance checks. Fixes bugs #1055180, #1051520, #1016026, #1016010. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** PgSQL.py 31 Jul 2004 20:20:13 -0000 1.43 --- PgSQL.py 27 Feb 2005 18:40:04 -0000 1.44 *************** *** 2323,2327 **** for k, v in vdict.items(): t[k]=_quote(v) ! elif type(vdict) in (StringType, UnicodeType): # Note: a string is a SequenceType, but is treated as a single # entity, not a sequence of characters. --- 2323,2327 ---- for k, v in vdict.items(): t[k]=_quote(v) ! elif isinstance(vdict, StringType) or isinstance(vdict, UnicodeType): # Note: a string is a SequenceType, but is treated as a single # entity, not a sequence of characters. *************** *** 2789,2798 **** if type(obj) is StringType: return obj ! elif type(obj) is UnicodeType: return obj.encode(*self.conn.client_encoding) elif type(obj) in (ListType, TupleType): converted_obj = [] for item in obj: ! if type(item) is UnicodeType: converted_obj.append(item.encode(*self.conn.client_encoding)) else: --- 2789,2798 ---- if type(obj) is StringType: return obj ! elif isinstance(obj, UnicodeType): return obj.encode(*self.conn.client_encoding) elif type(obj) in (ListType, TupleType): converted_obj = [] for item in obj: ! if isinstance(item, UnicodeType): converted_obj.append(item.encode(*self.conn.client_encoding)) else: *************** *** 2802,2806 **** converted_obj = {} for k, v in obj.items(): ! if type(v) is UnicodeType: converted_obj[k] = v.encode(*self.conn.client_encoding) else: --- 2802,2806 ---- converted_obj = {} for k, v in obj.items(): ! if isinstance(v, UnicodeType): converted_obj[k] = v.encode(*self.conn.client_encoding) else: *************** *** 2810,2814 **** obj = copy.copy(obj) for k, v in obj.items(): ! if type(v) is UnicodeType: obj[k] = v.encode(*self.conn.client_encoding) return obj --- 2810,2814 ---- obj = copy.copy(obj) for k, v in obj.items(): ! if isinstance(v, UnicodeType): obj[k] = v.encode(*self.conn.client_encoding) return obj |