示例#1
0
def commit_account_changes(user):
    if db_session.is_modified(user):
        try:
            db_session.add(user)
            db_session.commit()
        except Exception as e:
            flash("An unexpected error occurred! Please check the application "
                  "logs or inform your adminstrator.", "error")
            app.logger.error("Account changes for '{}' failed: {}".format(user,
                                                                          e))
            db_session.rollback()
        else:
            flash("Account successfully updated!", "success")
示例#2
0
def commit_account_changes(user):
    if db_session.is_modified(user):
        try:
            db_session.add(user)
            db_session.commit()
        except Exception as e:
            flash(gettext(
                "An unexpected error occurred! Please "
                  "inform your administrator."), "error")
            current_app.logger.error("Account changes for '{}' failed: {}"
                                     .format(user, e))
            db_session.rollback()
        else:
            flash(gettext("Account updated."), "success")
示例#3
0
def commit_account_changes(user):
    if db_session.is_modified(user):
        try:
            db_session.add(user)
            db_session.commit()
        except Exception as e:
            flash(
                gettext("An unexpected error occurred! Please "
                        "inform your administrator."), "error")
            current_app.logger.error(
                "Account changes for '{}' failed: {}".format(user, e))
            db_session.rollback()
        else:
            flash(gettext("Account updated."), "success")