Routes currently doesn't provide a very easy way to do this, so I've
added one. If you update your routes to the latest:
easy_install -U Routes==dev

You can now use an additional map option in yourproj/lib/routing.py,
map.sub_domains = True

And either require a sub domain to be present:
map.connect('', controller='user', action='home',
conditions=dict(sub_domains=True))

Or require a range of specific sub-domains:
map.connect('', controller='user', action='home',
conditions=dict(sub_domains=['fred','george']))

If you have multiple sub-domains that are equivilant to your hostname
(www.host.com == host.com), you can ignore those with:
map.sub_domains_ignore =['www']

url_for will now also handle the sub_domain keyword, ie:
url_for(action='list', sub_domain='george')

This will generate a URL with the sub-domain of 'george' based off the
current domain information. To determine the current domain name, a
regexp of: [^\.\/]+?\.[^\.\/]+ is used. Which will map
anything.anything, if you have a longer base (ie, domain.com.pl), you
can override the match:
map.domain_match = 'new_match_here'

Let me know how it works out for you.

HTH,
Ben


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

Reply via email to