On Apr 26, 2010, at 9:41 AM, annet wrote:
> Now I understand the problem. When I rewrite the _href:
>
> {{=A('View it in your browser', _href="
http://127.0.0.1:8000" +
> URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,
item.contactpersoon.id]),
> _target="_blank")}}
>
> ... the problem is solved. I guess I'd best add a variable containing
> the "
http://127.0.0.1:8000" value e.g. mydomain, and then:
>
> {{=A('View it in your browser', _href=mydomain +
> URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,
item.contactpersoon.id]),
> _target="_blank")}}
>
>
> Does anyone know a better solution?
Massimo will warn you, correctly, that this isn't a universal solution, but if your server configuration permits it, you might be able to extract your host name from request.env. Have a look at request.env.http_host or request.env.server_name, or at similar variables in request.wsgi.environ.
These won't always be correct (if you're behind a proxy such as Apache mod_proxy, for example), but if they *are* correct, it's probably better than hard-coding your hostname into your application.