From 6a9db1b36a646393fffcedfdcbba4e34f2e7585b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 15 Nov 2021 17:05:18 +0100 Subject: [PATCH] [pricelist] Fix minor issues --- flaschengeist/plugins/pricelist/__init__.py | 2 +- flaschengeist/plugins/pricelist/pricelist_controller.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flaschengeist/plugins/pricelist/__init__.py b/flaschengeist/plugins/pricelist/__init__.py index 7423d1e..9adace7 100644 --- a/flaschengeist/plugins/pricelist/__init__.py +++ b/flaschengeist/plugins/pricelist/__init__.py @@ -710,7 +710,7 @@ def get_priclist_setting(userid, current_session): return no_content() -@PriceListPlugin.blueprint.route("/drinks//picture", methods=["POST" "DELETE"]) +@PriceListPlugin.blueprint.route("/drinks//picture", methods=["POST", "DELETE"]) @login_required(permission=permissions.EDIT) def set_picture(identifier, current_session): """Get, Create, Delete Drink Picture diff --git a/flaschengeist/plugins/pricelist/pricelist_controller.py b/flaschengeist/plugins/pricelist/pricelist_controller.py index 69b011c..0d9567a 100644 --- a/flaschengeist/plugins/pricelist/pricelist_controller.py +++ b/flaschengeist/plugins/pricelist/pricelist_controller.py @@ -302,7 +302,7 @@ def update_drink(identifier, data): else: drink = get_drink(identifier) for key, value in data.items(): - if hasattr(drink, key): + if hasattr(drink, key) and key != 'has_image': setattr(drink, key, value if value != "" else None) if drink_type: @@ -531,7 +531,7 @@ def delete_extra_ingredient(identifier): def save_drink_picture(identifier, file): drink = get_drink(identifier) - drink.image = image_controller.upload_image(file) + drink.image_ = image_controller.upload_image(file) db.session.commit() return drink