{{{
File '/home/myself/src/myproject/myproject/lib/base.py', line 35 in
__call__
return TGController.__call__(self, environ, start_response)
File '/usr/local/lib/python2.6/dist-
packages/Pylons-0.9.7-py2.6.egg/pylons/controllers/core.py', line 217 in
__call__
response = self._inspect_call(self.__before__)
File '/usr/local/lib/python2.6/dist-
packages/Pylons-0.9.7-py2.6.egg/pylons/controllers/core.py', line 107 in
_inspect_call
result = self._perform_call(func, args)
File '/usr/local/lib/python2.6/dist-
packages/TurboGears2-2.0-py2.6.egg/tg/controllers.py', line 792 in
_perform_call
controller, remainder, params = self._get_routing_info(routingArgs)
File '/usr/local/lib/python2.6/dist-
packages/TurboGears2-2.0-py2.6.egg/tg/controllers.py', line 462 in
_get_routing_info
controller, remainder = _object_dispatch(self, url_path)
File '/usr/local/lib/python2.6/dist-
packages/TurboGears2-2.0-py2.6.egg/tg/controllers.py', line 528 in
_object_dispatch
return _find_restful_dispatch(obj, parent, remainder)
File '/usr/local/lib/python2.6/dist-
packages/TurboGears2-2.0-py2.6.egg/tg/controllers.py', line 593 in
_find_restful_dispatch
if remainder and hasattr(obj, remainder[0]) and remainder[0] not in
['new', 'edit']:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2:
ordinal not in range(128)
}}}
So, accessing entities with Unicode PKs via this RestController is not
possible.
--
Ticket URL: <http://trac.turbogears.org/ticket/2337>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
* version: 2.0rc1 => 2.0.1
--
Ticket URL: <http://trac.turbogears.org/ticket/2337#comment:1>
* severity: major => normal
* milestone: => 2.1
Comment:
This is indeed a valid bug, however the fix should be to throw an error as
unicode URLs should status is not well known. see
http://stackoverflow.com/questions/155892/unicode-url-decoding for
example.
Therefore I think the RestController should assume all URLs are ASCII-
encoded and complain if they are not rather than, allowing the PK as the
OP intended.
--
Ticket URL: <http://trac.turbogears.org/ticket/2337#comment:2>
* milestone: 2.1 => 2.1b2
--
Ticket URL: <http://trac.turbogears.org/ticket/2337#comment:3>
I've had some trouble reproducing this problem using WebTest -- it seems
that WebTest converts everything (including URLs) to str() when creating
the request. I tried reproducing by encoding the URL as UTF-8, but this
appears to work just fine. So without a failing test case, I'm not sure
what we can do here.
--
Ticket URL: <http://trac.turbogears.org/ticket/2337#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
I tested this in 2.1 on FFx, Safari, curl, and wget and found it to work
(aside from unittesting) Closing....
--
Ticket URL: <http://trac.turbogears.org/ticket/2337#comment:5>