|
|
@ -17,7 +17,7 @@ from ..models import ( |
|
|
|
get_session_factory, |
|
|
|
get_session_factory, |
|
|
|
get_tm_session, |
|
|
|
get_tm_session, |
|
|
|
) |
|
|
|
) |
|
|
|
# from ..models import MyModel |
|
|
|
from ..models.account import User, Role, passlib_context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def usage(argv): |
|
|
|
def usage(argv): |
|
|
@ -40,8 +40,17 @@ def main(argv=sys.argv): |
|
|
|
|
|
|
|
|
|
|
|
session_factory = get_session_factory(engine) |
|
|
|
session_factory = get_session_factory(engine) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
passlib_context.load_path(settings['passlib.config']) |
|
|
|
|
|
|
|
|
|
|
|
with transaction.manager: |
|
|
|
with transaction.manager: |
|
|
|
dbsession = get_tm_session(session_factory, transaction.manager) |
|
|
|
dbsession = get_tm_session(session_factory, transaction.manager) |
|
|
|
|
|
|
|
|
|
|
|
# model = MyModel(name='one', value=1) |
|
|
|
user = User( |
|
|
|
# dbsession.add(model) |
|
|
|
username='HolgerFrey', |
|
|
|
|
|
|
|
first_name='Holger', |
|
|
|
|
|
|
|
last_name='Frey', |
|
|
|
|
|
|
|
email='frey@imtek.de', |
|
|
|
|
|
|
|
role=Role.ADMIN |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
user.set_password('holgi') |
|
|
|
|
|
|
|
dbsession.add(user) |
|
|
|