views:

20

answers:

1

Subdomain behavior is not working as I expect in my Pylons project. Can someone provide some insight? I was using a named route and received back a URL that did not contain my current subdomain:

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