lint: various non-semantic fixes

This commit is contained in:
Iain Learmonth 2022-06-23 11:38:27 +01:00
parent cbd80cf7b3
commit 273dcb2a8a
5 changed files with 13 additions and 13 deletions

View file

@ -3,7 +3,7 @@ from datetime import datetime
from flask import render_template, url_for, flash, redirect, Response, Blueprint
from flask.typing import ResponseReturnValue
from flask_wtf import FlaskForm
from sqlalchemy import exc
import sqlalchemy
from wtforms import StringField, BooleanField, SubmitField
from wtforms.validators import DataRequired
@ -52,8 +52,7 @@ def group_new() -> ResponseReturnValue:
db.session.commit()
flash(f"Created new group {group.group_name}.", "success")
return redirect(url_for("portal.group.group_edit", group_id=group.id))
except exc.SQLAlchemyError as e:
print(e)
except sqlalchemy.exc.SQLAlchemyError:
flash("Failed to create new group.", "danger")
return redirect(url_for("portal.group.group_list"))
return render_template("new.html.j2", section="group", form=form)
@ -77,7 +76,7 @@ def group_edit(group_id: int) -> ResponseReturnValue:
try:
db.session.commit()
flash("Saved changes to group.", "success")
except exc.SQLAlchemyError:
except sqlalchemy.exc.SQLAlchemyError:
flash("An error occurred saving the changes to the group.", "danger")
return render_template("group.html.j2",
section="group",

View file

@ -16,10 +16,10 @@ bp = Blueprint("webhook", __name__)
@bp.app_template_filter("webhook_format_name")
def webhook_format_name(s: str) -> str:
if s == "telegram":
def webhook_format_name(format: str) -> str:
if format == "telegram":
return "Telegram"
if s == "matrix":
if format == "matrix":
return "Matrix"
return "Unknown"