On Apr 11, 2011, at 10:13 AM, LightOfMooN wrote:
> 
> Hello
> I have some records in my routes.py
> 
> in routes_in:
>    (r'.*://$sub\.domain\.ru:.* /?', r'/myapp/company/index/$sub'),
> 
> in routes_out:
>    ('/myapp/company/index/$sub', 'http://$sub.domain.ru'),
> 
> So, routes_in workds fine, but routes_out works only by http.
> Is there a way to get protocol in routes_out?

Do you mean the subdomain?

If the incoming request was for sub.domain.ru, then you want to return a URL 
that's relative to the scheme & domain, and let the browser fill them in.

If the request was for sub.domain.ru, and you're generating a URL for 
other.domain.ru, then you've got no choice but to specify the URL explicitly. 

It's probably best not to use URL() for the cross-domain case, I think. The 
parametric (new) router assumes that the URL being generated is in the same 
domain as the current request. I can see how it might be enhanced to support 
cross-domain URLs, but it's not trivial, and it doesn't happen now.

Reply via email to