Browse Source

Merge branch 'master' into module-support

Conflicts:
	flask.py
pull/1638/head
Armin Ronacher 15 years ago
parent
commit
36f659b82b
  1. 1
      CHANGES
  2. 4
      flask.py
  3. 2
      tests/flask_tests.py

1
CHANGES

@ -14,6 +14,7 @@ Version 0.2
- :meth:`~flask.Flask.add_url_rule` can now also register a
view function.
- server listens on 127.0.0.1 by default now to fix issues with chrome.
- added external URL support.
Version 0.1
-----------

4
flask.py

@ -179,6 +179,7 @@ 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.
"""
ctx = _request_ctx_stack.top
if '.' not in endpoint:
@ -187,7 +188,8 @@ def url_for(endpoint, **values):
endpoint = mod + '.' + endpoint
elif endpoint.startswith('.'):
endpoint = endpoint[1:]
return ctx.url_adapter.build(endpoint, values)
external = values.pop('_external', False)
return ctx.url_adapter.build(endpoint, values, force_external=external)
def get_template_attribute(template_name, attribute):

2
tests/flask_tests.py

@ -227,6 +227,8 @@ class BasicFunctionalityTestCase(unittest.TestCase):
pass
with app.test_request_context():
assert flask.url_for('hello', name='test x') == '/hello/test%20x'
assert flask.url_for('hello', name='test x', _external=True) \
== 'http://localhost/hello/test%20x'
def test_custom_converters(self):
from werkzeug.routing import BaseConverter

Loading…
Cancel
Save