Register most stuff only once
This commit is contained in:
parent
7a08331ac0
commit
f7e71b518f
2 changed files with 26 additions and 17 deletions
|
|
@ -583,6 +583,7 @@ class Flask(_PackageBoundObject):
|
|||
|
||||
.. versionadded:: 0.7
|
||||
"""
|
||||
first_registration = False
|
||||
if blueprint.name in self.blueprints:
|
||||
assert self.blueprints[blueprint.name] is blueprint, \
|
||||
'A blueprint\'s name collision ocurred between %r and ' \
|
||||
|
|
@ -590,7 +591,8 @@ class Flask(_PackageBoundObject):
|
|||
(blueprint, self.blueprints[blueprint.name], blueprint.name)
|
||||
else:
|
||||
self.blueprints[blueprint.name] = blueprint
|
||||
blueprint.register(self, options)
|
||||
first_registration = True
|
||||
blueprint.register(self, options, first_registration)
|
||||
|
||||
def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
|
||||
"""Connects a URL rule. Works exactly like the :meth:`route`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue