From 3cfe0251d126c5342715d03edc3ba839a2b79acf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 10 Mar 2021 16:51:21 +0100 Subject: [PATCH] Tentative fix for #95 --- worker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worker.py b/worker.py index 4228fee..847899b 100644 --- a/worker.py +++ b/worker.py @@ -1040,6 +1040,8 @@ class Worker(threading.Thread): price = None else: price = self.Price(price) + if not isinstance(price, CancelSignal) and price is not None: + price = int(price) # Ask for the product image self.bot.send_message(self.chat.id, self.loc.get("ask_product_image"), reply_markup=cancel) # Wait for an answer @@ -1050,7 +1052,7 @@ class Worker(threading.Thread): # noinspection PyTypeChecker product = db.Product(name=name, description=description, - price=int(price) if price is not None else None, + price=price, deleted=False) # Add the record to the database self.session.add(product) @@ -1059,7 +1061,7 @@ class Worker(threading.Thread): # Edit the record with the new values product.name = name if not isinstance(name, CancelSignal) else product.name product.description = description if not isinstance(description, CancelSignal) else product.description - product.price = int(price) if not isinstance(price, CancelSignal) else product.price + product.price = price if not isinstance(price, CancelSignal) else product.price # If a photo has been sent... if isinstance(photo_list, list): # Find the largest photo id