Skip to content
Myr

Merge branch '1.0-maintenance'

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

authored by David Lord · committed by David Lord · parents 35afec3, 939c77a · Browse files · 4 files+32 added−5 removed
This commit

State

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

Diff stats

4 files+32 added−5 removed

  • tests:+6 added−0 removed
  • other:+26 added−5 removed

4 files+32 added−5 removed

modified:flask/blueprints.py+6 added-3 removed
8 unmodified lines
9 :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11"""12from functools import update_wrapper13from werkzeug.urls import url_join1415from .helpers import _PackageBoundObject, _endpoint_from_view_func1617
31 unmodified lines
4950 url_prefix = self.options.get('url_prefix')51 if url_prefix is None:52 url_prefix = self.blueprint.url_prefix52 if url_prefix:53 url_prefix = url_prefix.rstrip('/')53 #: The prefix that should be used for all URLs defined on the54 #: blueprint.55 self.url_prefix = url_prefix56
7 unmodified lines
64 to the application. The endpoint is automatically prefixed with the65 blueprint's name.66 """67 if self.url_prefix is not None:69 rule = '/'.join((self.url_prefix, rule.lstrip('/')))68 if rule:69 rule = '/'.join((70 self.url_prefix.rstrip('/'), rule.lstrip('/')))71 else:72 rule = self.url_prefix73 options.setdefault('subdomain', self.subdomain)74 if endpoint is None:75 endpoint = _endpoint_from_view_func(view_func)76 defaults = self.url_defaults
372 unmodified lines
modified:flask/cli.py+4 added
823 unmodified lines
824def routes_command(sort, all_methods):825 """Show all registered routes with endpoints and methods."""826827 rules = list(current_app.url_map.iter_rules())828 if not rules:829 click.echo('No routes were registered.')830 return831832 ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))833834 if sort in ('endpoint', 'rule'):835 rules = sorted(rules, key=attrgetter(sort))
63 unmodified lines
modified:tests/test_blueprints.py+6 added
114 unmodified lines
115 assert client.get('/nope').data == b'you shall not pass'116117118@pytest.mark.parametrize(('prefix', 'rule', 'url'), (119 ('', '/', '/'),120 ('/', '', '/'),121 ('/', '/', '/'),122 ('/foo', '', '/foo'),123 ('/foo/', '', '/foo/'),124 ('', '/bar', '/bar'),125 ('/foo/', '/bar', '/foo/bar'),126 ('/foo/', 'bar', '/foo/bar'),127 ('/foo', '/bar', '/foo/bar'),128 ('/foo/', '//bar', '/foo/bar'),
728 unmodified lines
modified:CHANGES.rst+16 added-2 removed
8 unmodified lines
910Unreleased111213Version 1.0.213Version 1.0.314-------------1516Unreleased171819Version 1.0.220-------------2122Released on May 2nd 20182324- Fix more backwards compatibility issues with merging slashes between25 a blueprint prefix and route. (`#2748`_)26- Fix error with ``flask routes`` command when there are no routes.27 (`#2751`_)2829.. _#2748: https://github.com/pallets/flask/pull/274830.. _#2751: https://github.com/pallets/flask/issues/2751313233Version 1.0.134-------------3522Released on April 29 201836Released on April 29th 20183738- Fix registering partials (with no ``__name__``) as view functions.39 (`#2730`_)40- Don't treat lists returned from view functions the same as tuples.
876 unmodified lines