From a46bfa05c6f562976b19fc312f875a53fa950eaf Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 12 Sep 2017 11:41:13 +0200 Subject: [PATCH] Fix exception handling --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 245a992..9339a96 100644 --- a/server.py +++ b/server.py @@ -1,7 +1,7 @@ import os from flask import Flask, session, url_for, redirect, request, render_template, abort from flask_sqlalchemy import SQLAlchemy -from sqlalchemy.exc import OperationalError +from sqlalchemy.exc import IntegrityError import bcrypt app = Flask(__name__) @@ -612,7 +612,7 @@ if __name__ == "__main__": secondary_dns="0.0.0.0") db.session.add(retenulla) db.session.commit() - except OperationalError: + except IntegrityError: # Se queste operazioni sono già state compiute in precedenza, annullale db.session.rollback() # Esegui il sito in modalità debug