From 1b371763eee5cb1490a647574cdcd818c8b6d95f Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 13 Nov 2021 14:49:28 +0100 Subject: [PATCH] [events] Fix conflic return code --- flaschengeist/plugins/events/event_controller.py | 6 +++--- flaschengeist/plugins/users/__init__.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flaschengeist/plugins/events/event_controller.py b/flaschengeist/plugins/events/event_controller.py index 1bc8b43..fb50655 100644 --- a/flaschengeist/plugins/events/event_controller.py +++ b/flaschengeist/plugins/events/event_controller.py @@ -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): diff --git a/flaschengeist/plugins/users/__init__.py b/flaschengeist/plugins/users/__init__.py index 8a0db58..9b41070 100644 --- a/flaschengeist/plugins/users/__init__.py +++ b/flaschengeist/plugins/users/__init__.py @@ -75,7 +75,7 @@ def list_users(current_session): @UsersPlugin.blueprint.route("/users/", 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