Skip to content
Myr

Fixed late binding of url_prefix. This fixes #29.

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 720bede · Browse files · 2 files+10 added−1 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+10 added−1 removed

  • tests:+9 added−0 removed
  • other:+1 added−1 removed

2 files+10 added−1 removed

modified:tests/flask_tests.py+9 added
439 unmodified lines
440 assert c.get('/admin/').data == 'the admin'441 assert catched == ['before-app', 'before-admin',442 'after-admin', 'after-app']443444 def test_late_binding(self):445 app = flask.Flask(__name__)446 admin = flask.Module(__name__, 'admin')447 @admin.route('/')448 def index():449 return '42'450 app.register_module(admin, url_prefix='/admin')451 assert app.test_client().get('/admin/').data == '42'452453454def suite():455 from minitwit_tests import MiniTwitTestCase456 from flaskr_tests import FlaskrTestCase457 suite = unittest.TestSuite()
13 unmodified lines
modified:flask.py+1 added-1 removed
446 unmodified lines
447 the :func:`url_for` function is prefixed with the name of the module.448 """449 def register_rule(state):450 the_rule = rule451 if self.url_prefix:451 if state.url_prefix:452 the_rule = state.url_prefix + rule453 state.app.add_url_rule(the_rule, '%s.%s' % (self.name, endpoint),454 view_func, **options)455 self._record(register_rule)
586 unmodified lines