From 920937a51f778839e1d30d5bca07f89d0d49fe3b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 1 Oct 2021 13:30:39 +0200 Subject: [PATCH] fixing bug of trade without devices --- ereuse_devicehub/resources/action/schemas.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ereuse_devicehub/resources/action/schemas.py b/ereuse_devicehub/resources/action/schemas.py index ec11dd8f..5a1bb38c 100644 --- a/ereuse_devicehub/resources/action/schemas.py +++ b/ereuse_devicehub/resources/action/schemas.py @@ -707,6 +707,11 @@ class Trade(ActionWithMultipleDevices): required=True, only_query='id') + @pre_load + def adding_devices(self, data: dict): + if not 'devices' in data.keys(): + data['devices'] = [] + @validates_schema def validate_lot(self, data: dict): if not g.user.email in [data['user_from_email'], data['user_to_email']]: