On Tue, 2009-09-01 at 12:04 -0700, Mike Orr wrote:
> 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="/") ?
map.connect("/wsgi", controller="wsgiapp", path_info="/")
map.connect('/wsgi/{path_info:.*}', controller='wsgiapp')
yes, that seems to work! though I think we all agree that the new routes
solution would be better than having two rules plus a dummy
controller... ;-)
thanks
Iain
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---