Add ability to not register blueprint on app. Useful if combining apps such as an API layer and a frontend where the API is not concerned with rendering templates or handling traditional auth

This commit is contained in:
Matt Wright
2012-09-11 17:51:20 -04:00
parent 364646fc6b
commit c1141b57fa
5 changed files with 28 additions and 8 deletions
+3 -2
View File
@@ -14,7 +14,7 @@ from flask.ext.security import Security, UserMixin, RoleMixin, \
from tests.test_app import create_app as create_base_app, populate_data, \
add_context_processors
def create_app(config):
def create_app(config, register_blueprint=True):
app = create_base_app(config)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root@localhost/flask_security_test'
@@ -50,7 +50,8 @@ def create_app(config):
db.create_all()
populate_data()
app.security = Security(app, SQLAlchemyUserDatastore(db, User, Role))
app.security = Security(app, SQLAlchemyUserDatastore(db, User, Role),
register_blueprint=register_blueprint)
add_context_processors(app.security)