From 1e2a6f2ffb1c06840a5073fd1331c7857b137074 Mon Sep 17 00:00:00 2001 From: janeczku Date: Fri, 29 Apr 2016 22:54:38 +0200 Subject: [PATCH] Fix session.rollback on admin account creation --- cps/ub.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/ub.py b/cps/ub.py index 27c1d3ff..564e45b2 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -183,7 +183,11 @@ def create_admin_user(): user.password = generate_password_hash(DEFAULT_PASS) session.add(user) - session.commit() + try: + session.commit() + except: + session.rollback() + pass Session = sessionmaker() Session.configure(bind=engine)