Skip to content

Commit

Permalink
Merge branch '1.0-maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Apr 27, 2018
2 parents 08ef4d0 + 6663bf1 commit f7ac3a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Version 1.1
unreleased


Version 1.0.1
-------------

unreleased

- Fix registering partials (with no ``__name__``) as view functions

Version 1.0
-----------

Expand Down
2 changes: 1 addition & 1 deletion flask/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
"""
if endpoint:
assert '.' not in endpoint, "Blueprint endpoints should not contain dots"
if view_func:
if view_func and hasattr(view_func, '__name__'):
assert '.' not in view_func.__name__, "Blueprint view function name should not contain dots"
self.record(lambda s:
s.add_url_rule(rule, endpoint, view_func, **options))
Expand Down
3 changes: 3 additions & 0 deletions tests/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:license: BSD, see LICENSE for more details.
"""

import functools
import pytest

import flask
Expand Down Expand Up @@ -382,6 +383,8 @@ def foo_foo_foo():
)
)

bp.add_url_rule('/bar/456', endpoint='foofoofoo', view_func=functools.partial(foo_foo_foo))

app.register_blueprint(bp, url_prefix='/py')

assert client.get('/py/foo').data == b'bp.foo'
Expand Down

0 comments on commit f7ac3a7

Please sign in to comment.