[events] Fix conflic return code

This commit is contained in:
Ferdinand Thiessen 2021-11-13 14:49:28 +01:00
parent 974af80a9b
commit 1b371763ee
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
from datetime import datetime, timedelta, timezone
from typing import Optional
from werkzeug.exceptions import BadRequest, NotFound
from werkzeug.exceptions import BadRequest, Conflict, NotFound
from sqlalchemy.exc import IntegrityError
from flaschengeist import logger
@ -41,7 +41,7 @@ def create_event_type(name):
db.session.commit()
return event
except IntegrityError:
raise BadRequest("Name already exists")
raise Conflict("Name already exists")
def rename_event_type(identifier, new_name):
@ -50,7 +50,7 @@ def rename_event_type(identifier, new_name):
try:
db.session.commit()
except IntegrityError:
raise BadRequest("Name already exists")
raise Conflict("Name already exists")
def delete_event_type(name):

View File

@ -75,7 +75,7 @@ def list_users(current_session):
@UsersPlugin.blueprint.route("/users/<userid>", methods=["GET"])
@login_required()
@headers({"Cache-Control": "private, must-revalidate, max-age=3600"})
@headers({"Cache-Control": "private, must-revalidate, max-age=300"})
def get_user(userid, current_session):
"""Retrieve user by userid