Le 21/03/2012 18:11, Chris McDonough a écrit :
On Wed, 2012-03-21 at 13:53 +0100, tonthon wrote:
Hi,

I'm struggling with a lightweight application I wrote for internal use
in our company ( https://github.com/tonthon/etherpaddy ).

I encounter encoding errors while using it behind apache mod_wsgi.

I've got the following route configured :
config.add_route("pad", "/pads/{padid}")

When making an ajaxcall on /pads/t%C3%A9st
and calling
"""
request.matchdict.get('padid')
"""

from inside my view, I obtain :
"""
u't\\xe9st'
"""
That problem doesn't appear using the paster pserve command, but only
behind apache mod_wsgi.

After some inspection
The resulting environ['PATH_INFO'] is /pads/t\\xc3\\xa9st   (in place of
/pads/t\xc3\xa9st) backslashes are added.

So, in pyramid.traversal when pyramid converts it to unicode using the
decode_path_info, I get this wrong padid (u't\\xe9st').

Is there any way to solve this problem and get the expected value (other
than avoiding the use of url-to-be-escaped characters) ?
I'm not sure.  Since this problem happens only when behind mod_wsgi, I'm
apt to suggest to you to try it with a simple "raw" WSGI application
behind mod_wsgi instead of Pyramid and see if you can repeat it there.
If so, then you'll need to work out why mod_wsgi is incorrectly munging
PATH_INFO.

- C

First, thanks for your answer.

I can confirm mod_wsgi is returning a double backslash instead of a simple one when handling those chars.

I used this app :
"""
def application(environ, start_response):
    print environ
    start_response('200 OK', [('Content-Type', 'text/plain')])
    yield 'Hello World'
"""

and went to /testé, and I can found this one in my log file : {...., 'PATH_INFO': '/test\\xc3\\xa9', ...}

I'll try to look further but don't really know where to look.




--
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.

Reply via email to