Skip to content
Myr

Added _external support to url_for

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent a7266ff · Browse files · 3 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+7 added−1 removed

  • tests:+2 added−0 removed
  • other:+5 added−1 removed

3 files+7 added−1 removed

modified:tests/flask_tests.py+2 added
225 unmodified lines
226 def hello():227 pass228 with app.test_request_context():229 assert flask.url_for('hello', name='test x') == '/hello/test%20x'230 assert flask.url_for('hello', name='test x', _external=True) \231 == 'http://localhost/hello/test%20x'232233 def test_custom_converters(self):234 from werkzeug.routing import BaseConverter235 class ListConverter(BaseConverter):
164 unmodified lines
modified:CHANGES+1 added
12 unmodified lines
13- added :func:`~flask.get_template_attribute` helper function.14- :meth:`~flask.Flask.add_url_rule` can now also register a15 view function.16- server listens on 127.0.0.1 by default now to fix issues with chrome.17- added external URL support.1819Version 0.120-----------21
1 unmodified line
modified:flask.py+4 added-1 removed
150 unmodified lines
151 For more information, head over to the :ref:`Quickstart <url-building>`.152153 :param endpoint: the endpoint of the URL (name of the function)154 :param values: the variable arguments of the URL rule155 :param _external: if set to `True`, an absolute URL is generated.156 """157 external = values.pop('_external', False)156 return _request_ctx_stack.top.url_adapter.build(endpoint, values)158 return _request_ctx_stack.top.url_adapter.build(endpoint, values,159 force_external=external)160161162def get_template_attribute(template_name, attribute):163 """Loads a macro (or variable) a template exports. This can be used to
691 unmodified lines