forked from orbit-oss/flask
Merge branch '1.0-maintenance'
This commit is contained in:
commit
9bee619320
4 changed files with 32 additions and 5 deletions
18
CHANGES.rst
18
CHANGES.rst
|
|
@ -10,16 +10,30 @@ Version 1.1
|
||||||
Unreleased
|
Unreleased
|
||||||
|
|
||||||
|
|
||||||
Version 1.0.2
|
Version 1.0.3
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Unreleased
|
Unreleased
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on May 2nd 2018
|
||||||
|
|
||||||
|
- Fix more backwards compatibility issues with merging slashes between
|
||||||
|
a blueprint prefix and route. (`#2748`_)
|
||||||
|
- Fix error with ``flask routes`` command when there are no routes.
|
||||||
|
(`#2751`_)
|
||||||
|
|
||||||
|
.. _#2748: https://github.com/pallets/flask/pull/2748
|
||||||
|
.. _#2751: https://github.com/pallets/flask/issues/2751
|
||||||
|
|
||||||
|
|
||||||
Version 1.0.1
|
Version 1.0.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Released on April 29 2018
|
Released on April 29th 2018
|
||||||
|
|
||||||
- Fix registering partials (with no ``__name__``) as view functions.
|
- Fix registering partials (with no ``__name__``) as view functions.
|
||||||
(`#2730`_)
|
(`#2730`_)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
from functools import update_wrapper
|
from functools import update_wrapper
|
||||||
|
from werkzeug.urls import url_join
|
||||||
|
|
||||||
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
||||||
|
|
||||||
|
|
@ -49,8 +50,6 @@ class BlueprintSetupState(object):
|
||||||
url_prefix = self.options.get('url_prefix')
|
url_prefix = self.options.get('url_prefix')
|
||||||
if url_prefix is None:
|
if url_prefix is None:
|
||||||
url_prefix = self.blueprint.url_prefix
|
url_prefix = self.blueprint.url_prefix
|
||||||
if url_prefix:
|
|
||||||
url_prefix = url_prefix.rstrip('/')
|
|
||||||
#: The prefix that should be used for all URLs defined on the
|
#: The prefix that should be used for all URLs defined on the
|
||||||
#: blueprint.
|
#: blueprint.
|
||||||
self.url_prefix = url_prefix
|
self.url_prefix = url_prefix
|
||||||
|
|
@ -66,7 +65,11 @@ class BlueprintSetupState(object):
|
||||||
blueprint's name.
|
blueprint's name.
|
||||||
"""
|
"""
|
||||||
if self.url_prefix is not None:
|
if self.url_prefix is not None:
|
||||||
rule = '/'.join((self.url_prefix, rule.lstrip('/')))
|
if rule:
|
||||||
|
rule = '/'.join((
|
||||||
|
self.url_prefix.rstrip('/'), rule.lstrip('/')))
|
||||||
|
else:
|
||||||
|
rule = self.url_prefix
|
||||||
options.setdefault('subdomain', self.subdomain)
|
options.setdefault('subdomain', self.subdomain)
|
||||||
if endpoint is None:
|
if endpoint is None:
|
||||||
endpoint = _endpoint_from_view_func(view_func)
|
endpoint = _endpoint_from_view_func(view_func)
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,10 @@ def routes_command(sort, all_methods):
|
||||||
"""Show all registered routes with endpoints and methods."""
|
"""Show all registered routes with endpoints and methods."""
|
||||||
|
|
||||||
rules = list(current_app.url_map.iter_rules())
|
rules = list(current_app.url_map.iter_rules())
|
||||||
|
if not rules:
|
||||||
|
click.echo('No routes were registered.')
|
||||||
|
return
|
||||||
|
|
||||||
ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))
|
ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))
|
||||||
|
|
||||||
if sort in ('endpoint', 'rule'):
|
if sort in ('endpoint', 'rule'):
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,12 @@ def test_blueprint_app_error_handling(app, client):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
|
@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
|
||||||
|
('', '/', '/'),
|
||||||
|
('/', '', '/'),
|
||||||
|
('/', '/', '/'),
|
||||||
|
('/foo', '', '/foo'),
|
||||||
|
('/foo/', '', '/foo/'),
|
||||||
|
('', '/bar', '/bar'),
|
||||||
('/foo/', '/bar', '/foo/bar'),
|
('/foo/', '/bar', '/foo/bar'),
|
||||||
('/foo/', 'bar', '/foo/bar'),
|
('/foo/', 'bar', '/foo/bar'),
|
||||||
('/foo', '/bar', '/foo/bar'),
|
('/foo', '/bar', '/foo/bar'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue