Hello,
It seems that SQLObject doesn't allow unicode string when running SQL
statements, specifically to specify values for UnicodeCol keys. OTOH, when
creating an object, unicode strings is accepted and converted properly into
needed encoding, like utf-8.
Is it a bug or I'm doing something wrong?
Setup: an SQLObject class with UnicodeCol column.
Action: doing cls.selectBy(that_unicode_col=u'some string')
This results in error, like this one:
Traceback (most recent call last):
File "c:\python24\lib\site-packages\nose-0.8.3-py2.4.egg\nose\core.py", line
112, in runTest
self.testFunc()
File "D:\Projects\Spaca\ctests\test_model.py", line 65, in test_spa_and_coll
assert Spa.byName(u'f\xfcnf') is s3
File "D:\Projects\Spaca\spaca\model.py", line 101, in byName
matches = list(sr)
File
"d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\sresults.py",
line 155, in __iter__
return iter(list(self.lazyIter()))
File
"d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\sresults.py",
line 163, in lazyIter
return conn.iterSelect(self)
File
"d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\dbconnection.py",
line 763, in iterSelect
select, keepConnection=True)))
File
"d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\dbconnection.py",
line 695, in __init__
self.dbconn._executeRetry(self.rawconn, self.cursor, self.query)
File
"d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\mysql\mysqlconnection.py",
line 60, in _executeRetry
return cursor.execute(query)
File "C:\Python24\lib\site-packages\MySQLdb\cursors.py", line 137, in execute
self.errorhandler(self, exc, value)
File "C:\Python24\lib\site-packages\MySQLdb\connections.py", line 33, in
defaulterrorhandler
raise errorclass, errorvalue
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position
118: ordinal not in range(128)
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss