mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-20 12:20:08 +08:00
Significant design change: commit data after some requests to avoid multiple database hits when using SQLALchemy
This commit is contained in:
@@ -24,6 +24,7 @@ from flask.ext.security.exceptions import RoleNotFoundError
|
||||
def create_roles():
|
||||
for role in ('admin', 'editor', 'author'):
|
||||
current_app.security.datastore.create_role(name=role)
|
||||
current_app.security.datastore._commit()
|
||||
|
||||
|
||||
def create_users():
|
||||
@@ -34,6 +35,7 @@ def create_users():
|
||||
('tiya@lp.com', 'password', [], False)):
|
||||
current_app.security.datastore.create_user(
|
||||
email=u[0], password=u[1], roles=u[2], active=u[3])
|
||||
current_app.security.datastore._commit()
|
||||
|
||||
|
||||
def populate_data():
|
||||
|
||||
Reference in New Issue
Block a user