Browse Source

Fix blueprint route for ""

pull/2748/head
Hsiaoming Yang 7 years ago
parent
commit
f7a3bdc6db
No known key found for this signature in database
GPG Key ID: 7E55E3E0118B2B4C
  1. 3
      flask/blueprints.py
  2. 1
      tests/test_blueprints.py

3
flask/blueprints.py

@ -66,7 +66,10 @@ class BlueprintSetupState(object):
blueprint's name.
"""
if self.url_prefix is not None:
if rule:
rule = '/'.join((self.url_prefix, rule.lstrip('/')))
else:
rule = self.url_prefix
options.setdefault('subdomain', self.subdomain)
if endpoint is None:
endpoint = _endpoint_from_view_func(view_func)

1
tests/test_blueprints.py

@ -116,6 +116,7 @@ def test_blueprint_app_error_handling(app, client):
@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
('/foo', '', '/foo'),
('/foo/', '/bar', '/foo/bar'),
('/foo/', 'bar', '/foo/bar'),
('/foo', '/bar', '/foo/bar'),

Loading…
Cancel
Save