From 0a3db24c87771f11371087ebbdd40dc712f7bdd5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 24 Jun 2020 14:36:39 +0200 Subject: [PATCH] Fix __repr__ being parsed as html entities --- database.py | 6 +++--- worker.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/database.py b/database.py index 8d8b99b..c305828 100644 --- a/database.py +++ b/database.py @@ -85,7 +85,7 @@ class User(TableDeclarativeBase): return self.first_name def __repr__(self): - return f"" + return f"" class Product(TableDeclarativeBase): @@ -199,7 +199,7 @@ class Transaction(TableDeclarativeBase): return string def __repr__(self): - return f"" + return f"" class Admin(TableDeclarativeBase): @@ -258,7 +258,7 @@ class Order(TableDeclarativeBase): joined_self = session.query(Order).filter_by(order_id=self.order_id).join(Transaction).one() items = "" for item in self.items: - items += str(item) + "\n" + items += item.text(loc=loc) + "\n" if self.delivery_date is not None: status_emoji = loc.get("emoji_completed") status_text = loc.get("text_completed") diff --git a/worker.py b/worker.py index c037f05..468b4f6 100644 --- a/worker.py +++ b/worker.py @@ -1129,9 +1129,11 @@ class Worker(threading.Thread): self.session.commit() # Notify the user of the credit/debit self.bot.send_message(user.user_id, - self.loc.get("notification_transaction_created", transaction=str(transaction))) + self.loc.get("notification_transaction_created", + transaction=transaction.text(loc=self.loc))) # Notify the admin of the success - self.bot.send_message(self.chat.id, self.loc.get("success_transaction_created", transaction=str(transaction))) + self.bot.send_message(self.chat.id, self.loc.get("success_transaction_created", + transaction=transaction.text(loc=self.loc))) def __help_menu(self): """Help menu. Allows the user to ask for assistance, get a guide or see some info about the bot."""