Skip to content
Myr

Test that dotted names work. This fixes #258

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 85efa3f · Browse files · 2 files+26 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+26 added−1 removed

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

2 files+26 added−1 removed

modified:flask/wrappers.py+1 added-1 removed
78 unmodified lines
79 @property80 def blueprint(self):81 """The name of the current blueprint"""82 if self.url_rule and '.' in self.url_rule.endpoint:83 return self.url_rule.endpoint.split('.', 1)[0]83 return self.url_rule.endpoint.rsplit('.', 1)[0]8485 @cached_property86 def json(self):87 """If the mimetype is `application/json` this will contain the
24 unmodified lines
modified:tests/flask_tests.py+25 added
1321 unmodified lines
13221323 with flask.Flask(__name__).test_request_context():1324 assert flask.render_template('nested/nested.txt') == 'I\'m nested'13251326 def test_dotted_names(self):1327 frontend = flask.Blueprint('myapp.frontend', __name__)1328 backend = flask.Blueprint('myapp.backend', __name__)13291330 @frontend.route('/fe')1331 def frontend_index():1332 return flask.url_for('myapp.backend.backend_index')13331334 @frontend.route('/fe2')1335 def frontend_page2():1336 return flask.url_for('.frontend_index')13371338 @backend.route('/be')1339 def backend_index():1340 return flask.url_for('myapp.frontend.frontend_index')13411342 app = flask.Flask(__name__)1343 app.register_blueprint(frontend)1344 app.register_blueprint(backend)13451346 c = app.test_client()1347 self.assertEqual(c.get('/fe').data.strip(), '/be')1348 self.assertEqual(c.get('/fe2').data.strip(), '/fe')1349 self.assertEqual(c.get('/be').data.strip(), '/fe')135013511352class SendfileTestCase(unittest.TestCase):13531354 def test_send_file_regular(self):1355 app = flask.Flask(__name__)
430 unmodified lines