#1130: logging crashes when URL contains unicode symbols and user is logged in
(mod_python system)
------------------------+---------------------------------------------------
Reporter: dado1945 | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: TurboGears | Version: 1.0b1
Severity: critical | Keywords:
------------------------+---------------------------------------------------
It is quite hard to reproduce this bug because it requires TurboGears
running behind apache using mod_python.
I think similar configuration was used:
http://trac.turbogears.org/turbogears/wiki/ModPythonIntegration09
Next requirement is unicode characters in URL and user must be logged in
(I am using standart TG identity mechanism).
This produce following traceback (and system does not work as intended):
2006-09-28 12:30:53,818 cherrypy.msg INFO : Page handler: 'ordinal not in
range(128)'
Traceback (most recent call last):
File "/usr/lib/python2.4/site-
packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpwsgi.py", line 75, in
wsgiApp
environ['wsgi.input'])
File "/usr/lib/python2.4/site-
packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 78, in
run
_cputil.get_special_attribute("_cp_log_access", "_cpLogAccess")()
File "/usr/lib/python2.4/site-packages/TurboGears-1.0b1-
py2.4.egg/turbogears/controllers.py", line 450, in _cp_log_access
'') or "-",
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 28:
ordinal not in range(128)
The reason can be illustrated with following example:
>>> a
'dalius'
>>> b
'\xc5\xbev\xc4\x97ris'
>>> '%s %s' % (a, b)
'dalius \xc5\xbev\xc4\x97ris'
>>> a = u'dalius'
>>> '%s %s' % (a, b)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0:
ordinal not in range(128)
>>>
If we check /usr/lib/python2.4/site-packages/TurboGears-1.0b1-
py2.4.egg/turbogears/controllers.py line 450 we will find that username is
unicode and url is utf-8 string. I think following check would help:
if isinstance(username, unicode):
username = username.encode('utf-8')
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1130>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---