Hi,
When request URL is ascii both dispatch and traversal work but when
URL is encoded dispatch works but traversal returns error
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u0105'
in position 1: ordinal not in range(256).
http://localhost:6543/traversal/a%C5%9B
I guess maybe url is decoded to early. Could you give me a hint on
this?
from pyramid.config import Configurator
from pyramid.response import Response
from paste.httpserver import serve
class Root(object):
def __init__(self, request):
pass
def __getitem__(self, key):
return Resource(key)
class Resource(dict):
def __init__(self, v):
self.val = v
def the_view(context, request):
return Response(request.path_info)
if __name__ == '__main__':
config = Configurator()
config.add_route('the_route', 'dispatch/{foo}',
request_method='GET')
config.add_view(the_view, route_name='the_route')
config.add_route('trav_route', 'traversal/{traverse:.*}',
factory=Root, request_method='GET')
config.add_view(the_view, route_name='trav_route')
serve(config.make_wsgi_app(), port='6543')
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.