Significant design change: commit data after some requests to avoid multiple database hits when using SQLALchemy

This commit is contained in:
Matt Wright
2012-08-17 13:19:40 -04:00
parent b7d71f8c59
commit a39f46854e
5 changed files with 21 additions and 4 deletions
+2
View File
@@ -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():