Alberto Valverde wrote: > Gustavo Narea wrote: > >> On Tuesday February 3, 2009 13:20:58 Alberto Valverde wrote: >> >> >>> url = '%s://%s%s' % tuple(environ[k] for k in "wsgi.url_scheme", >>> "HTTP_HOST", "SCRIPT_NAME") >>> >>> >> Or: >> from paste.request import construct_url >> url = construct_url(environ) >> >> Which will also take the port into account. >> > Nice shortcut, thanks! Anyway, ftr, HTTP_HOST already contains the port > so both solutions are valid. >
BTW, to use construct_url to get the base url of the application (what I think the P wanted, instead of the url of the request currently being served) one needs to tell it not to take PATH_INFO and the query string into account, so that should be: construct_url(environ, with_query_string=False, with_path_info=False) Alberto --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

