register self._state when using init_app

Brings `security.init_app(app)` inline with `security = Security(app)` by registering security._state upon security.init_app. 

Without this change `security.send_mail_task` will give an infinite recursion error.
This commit is contained in:
M Clark
2016-01-21 15:44:19 +08:00
parent 8b1ab24341
commit 6f2f3481f4
+3 -3
View File
@@ -423,7 +423,7 @@ class Security(object):
identity_loaded.connect_via(app)(_on_identity_loaded)
state = _get_state(app, datastore,
self._state = _get_state(app, datastore,
login_form=login_form,
confirm_register_form=confirm_register_form,
register_form=register_form,
@@ -435,11 +435,11 @@ class Security(object):
anonymous_user=anonymous_user)
if register_blueprint:
app.register_blueprint(create_blueprint(state, __name__))
app.register_blueprint(create_blueprint(self._state, __name__))
app.context_processor(_context_processor)
state.render_template = self.render_template
app.extensions['security'] = state
app.extensions['security'] = self._state
return state