[SQL-CVS] [ sqlobject-Bugs-1547743 ] sqlobject-0.7.1dev_r1884, Mysql and unicode
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: SourceForge.net <no...@so...> - 2006-09-01 20:00:50
|
Bugs item #1547743, was opened at 2006-08-28 10:57 Message generated for change (Comment added) made by dado1945 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 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: MySQL Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Submitted By: dado1945 (dado1945) Assigned to: Nobody/Anonymous (nobody) Summary: sqlobject-0.7.1dev_r1884, Mysql and unicode Initial Comment: Please, check if suplied string is not unicode already in mysqlconnection.py. There is extract how it could look like: import types ..... if self.need_unicode: # For MysqlDB 1.2.1 and later, we go # encoding->unicode->charset (in the mysql db) if type(query) != types.UnicodeType: query = unicode(query, self.encoding) return cursor.execute(query) else: return cursor.execute(query) ..... Or use "isinstance(query, unicode)". I don't know what different we will have and which one is better to use however. ---------------------------------------------------------------------- >Comment By: dado1945 (dado1945) Date: 2006-09-01 23:00 Message: Logged In: YES user_id=1533929 I think here is answer: >>> u = u'1' >>> a = '%s' % u >>> type(a) <type 'unicode'> ---------------------------------------------------------------------- Comment By: dado1945 (dado1945) Date: 2006-09-01 22:58 Message: Logged In: YES user_id=1533929 Here how it happens. I have checked all the traceback and have not found anything what would change unicode string to simple string. I happens only in select it seems. Assignment work OK as far as I remember. File "D:\daliaus\projects\tekshtpleksht\tekshtpleksht\controllers.py", line 208, in save page = model.Article.byName(pagename) File "<string>", line 1, in <lambda> File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1266, in _SO_fetchAlternateID result, obj = cls._findAlternateID(name, dbName, value, connection) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1262, in _findAlternateID value), None File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 590, in _SO_selectOneAlt return self.queryOne("SELECT %s FROM %s WHERE %s = %s" % File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 760, in queryOne return self._dbConnection._queryOne(self._connection, s) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 342, in _queryOne self._executeRetry(conn, c, s) File "D:\Program Files\Python2.4\lib\site-packages\sqlobject-0.7.1dev_r1860-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 74, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 18:28 Message: Logged In: YES user_id=4799 But how can the query be unicode in _executeRetry()? The query came from SQLObject so it must be an ascii string here... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 |