Skip to content
Myr

add more merge cases

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 · parent f7a3bdc · Browse files · 2 files+8 added−3 removed
This commit

State

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

Diff stats

2 files+8 added−3 removed

  • tests:+5 added−0 removed
  • other:+3 added−3 removed

2 files+8 added−3 removed

modified:flask/blueprints.py+3 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
8 unmodified lines
65 blueprint's name.66 """67 if self.url_prefix is not None:68 if rule:70 rule = '/'.join((self.url_prefix, rule.lstrip('/')))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:
374 unmodified lines
modified:tests/test_blueprints.py+5 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