parent
e97f6e22e6
commit
0f7b3a4f26
2 changed files with 41 additions and 15 deletions
|
|
@ -159,18 +159,25 @@ class Blueprint(_PackageBoundObject):
|
|||
return BlueprintSetupState(self, app, options, first_registration)
|
||||
|
||||
def register(self, app, options, first_registration=False):
|
||||
"""Called by :meth:`Flask.register_blueprint` to register a blueprint
|
||||
on the application. This can be overridden to customize the register
|
||||
behavior. Keyword arguments from
|
||||
:func:`~flask.Flask.register_blueprint` are directly forwarded to this
|
||||
method in the `options` dictionary.
|
||||
"""Called by :meth:`Flask.register_blueprint` to register all views
|
||||
and callbacks registered on the blueprint with the application. Creates
|
||||
a :class:`.BlueprintSetupState` and calls each :meth:`record` callback
|
||||
with it.
|
||||
|
||||
:param app: The application this blueprint is being registered with.
|
||||
:param options: Keyword arguments forwarded from
|
||||
:meth:`~Flask.register_blueprint`.
|
||||
:param first_registration: Whether this is the first time this
|
||||
blueprint has been registered on the application.
|
||||
"""
|
||||
self._got_registered_once = True
|
||||
state = self.make_setup_state(app, options, first_registration)
|
||||
|
||||
if self.has_static_folder:
|
||||
state.add_url_rule(self.static_url_path + '/<path:filename>',
|
||||
view_func=self.send_static_file,
|
||||
endpoint='static')
|
||||
state.add_url_rule(
|
||||
self.static_url_path + '/<path:filename>',
|
||||
view_func=self.send_static_file, endpoint='static'
|
||||
)
|
||||
|
||||
for deferred in self.deferred_functions:
|
||||
deferred(state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue