On Jun 17, 2010, at 6:45 AM, lwolf wrote:

> pylons and subdomains problem
> 
> Hi to all pylons developers!
> I'm trying to configure pylons project to work with subdomains and
> faced problem of how pylons defines domain and subdomains:
> for example url like sub.example.com it defines right - sub is a
> subdomain of example.com
> but for url like sub.example.com.us it says that sub.example is
> subdomain of com.us
> 
> Is it possible to configure domain name structure?

Yep, there's a master setting for how it matches the main 'domain' to then 
determine sub-domains. You can see the default on the mapper object here:
http://bitbucket.org/bbangert/routes/src/tip/routes/mapper.py#cl-377

Changing that will change how it matches sub-domains. At the moment its a 
global option, it should prolly at some point be updated to be able to match 
sub-domain in a more straight forward way, for example something like (purely 
hypothetical):
map.connect('/user/admin', 
requirements=dict(sub_domain_match='{sub_domain}.example.com.us'))

That'd also make it easier to use it to match entire domains as well (which 
I've seen requests for). For those wanting to arbitrarily match something in 
the request, there's also conditional functions you can specify that can add 
things from the WSGI environ into the Route dict, and determine if a route 
matches or not.

Cheers,
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to