#209 _executeRetry fails if self.encoding is utf8

closed-wont-fix
nobody
MySQL (29)
5
2007-02-08
2007-02-05
Anonymous
No

Version: SQLObject-0.8.0b2-py2.4
E-Mail adresse: sqlobject@xcore.net

_executeRetry fails if self.encoding is utf8. My connection string looks as follows:

sqlobject.dburi="mysql://foo:bar@localhost/mallorca?use_unicode=1&unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8&sqlobject_encoding=utf8"

I think changing sqlobject/mysql/my
sqlconnection.py Line 98

from

if self.need_unicode:
doo something

to

if self.need_unicode and self.encoding != "utf8"

would solve the problem

--- snip --
500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: <function _wrapper at 0xb71b5764>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
self.main()
File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/identity/conditions.py", line 275, in _wrapper
return fn( *args, **kw )
File "<string>", line 3, in default
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 334, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/database.py", line 302, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 351, in <lambda>
mapping, fragment, args, kw)))
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 391, in _execute_func
return _process_output(output, template, format, content_type, mapping, fragment)
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 82, in _process_output
fragment=fragment)
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/view/base.py", line 131, in render
return engine.render(**kw)
File "/usr/lib/python2.4/site-packages/TurboCheetah-0.9.5-py2.4.egg/turbocheetah/cheetahsupport.py", line 115, in render
return str(tempobj)
File "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py", line 990, in __str__
def __str__(self): return getattr(self, mainMethName)()
File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_base.py", line 474, in respond
_v = VFFSL(SL,"content",True) # '${content}' on line 114, col 13
File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_fincas.py", line 95, in content
for object in VFFSL(SL,"objects",True): # generated from line 11, col 9
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 160, in __iter__
return iter(list(self.lazyIter()))
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 168, in lazyIter
return conn.iterSelect(self)
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 831, in iterSelect
select, keepConnection=True)))
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 760, in __init__
self.dbconn._executeRetry(self.rawconn, self.cursor, self.query)
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/mysql/mysqlconnection.py", line 98, in _executeRetry
myquery = unicode(query, self.encoding)
TypeError: decoding Unicode is not supported
-- snip --

Discussion

  • Oleg Broytman
    Oleg Broytman
    2007-02-08

    Logged In: YES
    user_id=4799
    Originator: NO

    You've used a unicode expression where it is not allowed.

     
  • Oleg Broytman
    Oleg Broytman
    2007-02-08

    • status: open --> closed-wont-fix