Added _external support to url_for

This commit is contained in:
Armin Ronacher 2010-05-02 19:10:44 +02:00
parent a7266ffb90
commit 75461c1467
3 changed files with 7 additions and 1 deletions

View file

@ -152,8 +152,11 @@ def url_for(endpoint, **values):
:param endpoint: the endpoint of the URL (name of the function)
:param values: the variable arguments of the URL rule
:param _external: if set to `True`, an absolute URL is generated.
"""
return _request_ctx_stack.top.url_adapter.build(endpoint, values)
external = values.pop('_external', False)
return _request_ctx_stack.top.url_adapter.build(endpoint, values,
force_external=external)
def get_template_attribute(template_name, attribute):