On Fri, Aug 27, 2010 at 6:06 AM, dave <[email protected]> wrote: > I have the following rule defined on my mapper: > > map.sub_domains = True > ... > map.connect('openid_verify', '/verify', controller='oid', > action='verify') > > > In my controller, I put the following two lines of code: > > print url('openid_verify') > print url(controller='oid', action='verify') > > I would expect those two lines to always print the same thing. > However, when I visit the host 'sub.localhost.local:8080', I get the > following output: > > http://localhost.local:8080/verify > /verify > > Why is the named route fully qualified with the wrong host? Looking in > the request.environ dict clearly shows that I am visiting a subdomain.
I don't know, it could be a bug in named route generation. Cc'ing Ben. The examples in the manual show only the controller-action syntax. Named routes should work, but perhaps they don't. I'm also surprised that you're getting the host prefix when you didn't specify 'qualified=True'. If you're not spanning domains (going from one subdomain to another), eliminating the host prefix would also solve your problem, right? > The following code also correctly prints out the host: > > from routes import request_config > ... > > r = request_config() > r.load_wsgi_environ(request.environ) > print r.host request_config is an older construct, used to support url_for(). In Pylons 1 apps it's not initialized, but if your app is older it may still be doing it (in middleware.py -- new apps have 'singleton=False' in the RoutesMiddleware line). Without the singleton, it just uses the 'environ' and puts the routing results in the 'environ'. So I would just focus on the 'environ' and ignore 'request_config()'. -- 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.
