1 message in com.googlegroups.pylons-discuss[Routes] Sub-domains| From | Sent On | Attachments |
|---|---|---|
| Robert Leftwich | 19 Feb 2007 18:38 |
| Subject: | [Routes] Sub-domains![]() |
|---|---|
| From: | Robert Leftwich (pylo...@public.gmane.org) |
| Date: | 02/19/2007 06:38:43 PM |
| List: | com.googlegroups.pylons-discuss |
The sub-domain handling in Routes could perhaps be made more explicit and less aggressive. As an example, if I have sub_domains turned on and have a domain for serving the static side of the site, imaginatively called static.example.com and the normal www.example.com. All calls to url_for() that don't include a sub_domain keyword will behave as if sub_domain=None has been specified and will generate urls' w/o the www, such as http://example.com/index.html. Note that this is w/o anything being set for sub_domains_ignore.
This is probably acceptable if you have complete control over the domain and can setup your web server to handle the missing www. However, if you run a web server on a dynamic dns setup as I do, then Routes strips off the vital sub-domain entry, e.g. pylons.dyndns.org ends up with url's pointing to dyndns.org which is not usable.
I wonder if a small change to _subdomain_check() in Routes utils.py is warranted, so that it only processed sub-domains if the keyword args explicitly contained sub_domain, i.e. the first line becomes:
if config.mapper.sub_domains and kargs.has_key('sub_domain'): ...
This way no sub-domain processing is performed unless it is explicitly asked for and the sub_domain=None behaviour is unchanged.
Thoughts?
Robert




