From: SourceForge.net <no...@so...> - 2008-03-11 09:14:59
|
Bugs item #1911722, was opened at 2008-03-11 10:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1911722&group_id=16528 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: PgNumeric Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Pietro Bernardi (bpietro2) Assigned to: Nobody/Anonymous (nobody) Summary: Unicode value can't be converted? Initial Comment: All versions of PgSQL (including last one, 2.5.1) have this omission: Unlike StringType, UnicodeType can't be converted to PgNumeric; see example: >>> from pyPgSQL import PgSQL >>> a = '10.1' >>> b = PgSQL.PgNumeric(a) >>> b <PgNumeric instance - precision: 3 scale: 1 value: 10.1> >>> c = u'10.1' >>> d = PgSQL.PgNumeric(c) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py", line 1447, in __init__ raise TypeError, "value can not be converted to a PgNumeric." TypeError: value can not be converted to a PgNumeric. Almost all wxwidgets now return unicode value, which must be casted to string for conversion to PgNumeric. Simple patch can remedy it: PgSQL.py line 1469: elif type(value) in (FloatType, StringType): replace it with: elif type(value) in (FloatType, StringType, UnicodeType): Regards, Pietro ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1911722&group_id=16528 |