From 0c99a85361f469857c84d50f7ba8085023f4e00d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 2 Jun 2021 13:46:28 +0200 Subject: [PATCH] add raise instead of assert --- ereuse_devicehub/resources/action/views/trade.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/action/views/trade.py b/ereuse_devicehub/resources/action/views/trade.py index d5aa3d96..7b92673c 100644 --- a/ereuse_devicehub/resources/action/views/trade.py +++ b/ereuse_devicehub/resources/action/views/trade.py @@ -58,7 +58,9 @@ class TradeView(): # check than the user than want to do the action is one of the users # involved in the action - assert g.user in [self.trade.user_from, self.trade.user_to] + if not g.user in [self.trade.user_from, self.trade.user_to]: + txt = "You do not participate in this trading" + raise ValidationError(txt) confirm_from = Confirm(user=self.trade.user_from, action=self.trade,