On Tue, Sep 1, 2009 at 11:54 AM, Iain Duncan<[email protected]> wrote:
>
> On Tue, 2009-09-01 at 10:53 -0700, Jason S. wrote:
>> > > map.connect("/admin/{path_info:.*}", controller="admin")
>> >
>> > Hi Mike and others, I just tried that and the wsgi callable still gets
>> > an altereded evn. Path info is '/admin' and script name is still ''. Any
>> > ideas what might have gone wrong? or other ways to accomplish this?
>> >
>> > thanks
>> > Iain
>>
>> It seems likely the problem is the trailing slash. The rule in Mike's
>> example has a slash after admin, and this will not match /admin. On
>> the other hand, that wouldn't explain why your controller is getting
>> called at all... did you leave the previous rule you had in?
>
> Ok, something is funny here I think. I made some tests, here's the wsgi
> app in wsgiapp.py:
>
> class WSGIApp(object):
>    def __call__(self, environ, start_response):
>        print "WSGIApp.__call__() SCRIPT_NAME: '%s'  PATH_INFO: '%s'\n"
> % ( environ['SCRIPT_NAME'], environ['PATH_INFO'] )
>        res = Response("Hello world from WSGIApp")
>        return res(environ, start_response)
>
> WsgiappController =  WSGIApp()
>
>
> So here's the output with:
> map.connect('/wsgi{path_info:.*}', controller='wsgiapp')
>
> url: 127.0.0.1:5000/wsgi
> WSGIApp.__call__() SCRIPT_NAME: '/wsgi'  PATH_INFO: '/'
> (good)
>
> url: 127.0.0.1:5000/wsgi/
> WSGIApp.__call__() SCRIPT_NAME: '/wsgi'  PATH_INFO: '/'
> (still good)
>
> url: 127.0.0.1:5000/wsgi/foo/bar
> WSGIApp.__call__() SCRIPT_NAME: '/wsgi/foo/bar'  PATH_INFO: '/foo/bar'
> ( script name is screwed up )

This looks like a bug in Routes.  Perhaps it has never been tested
without a preceding slash in the path.

> And here's the output with:
> map.connect('/wsgi/{path_info:.*}', controller='wsgiapp')
>
> url: 127.0.0.1:5000/wsgi
> 404'd!

Understandable.  You'd need a separate route for "/wsgi" in this case.
 Does it work with map.connect("/wsgi", controller="wsgiapp",
path_info="/") ?

> url: 127.0.0.1:5000/wsgi/
> WSGIApp.__call__() SCRIPT_NAME: '/wsgi'  PATH_INFO: '/'
> (good)
>
> url: 127.0.0.1:5000/wsgi/foo/bar
> WSGIApp.__call__() SCRIPT_NAME: '/wsgi'  PATH_INFO: '/foo/bar'
>
> So I guess I can't figure out how to make sure that /wsgi still calls
> the app without hosing the env for the other paths. Putting both rules
> in mucks up the other paths. Thoughts?

-- 
Mike Orr <[email protected]>

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