1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

Fix __repr__ being parsed as html entities

This commit is contained in:
Steffo 2020-06-24 14:36:39 +02:00
parent 4a9b911940
commit 0a3db24c87
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
2 changed files with 7 additions and 5 deletions

View file

@ -85,7 +85,7 @@ class User(TableDeclarativeBase):
return self.first_name return self.first_name
def __repr__(self): def __repr__(self):
return f"<User {self} having {self.credit} credit>" return f"<User {self.mention()} having {self.credit} credit>"
class Product(TableDeclarativeBase): class Product(TableDeclarativeBase):
@ -199,7 +199,7 @@ class Transaction(TableDeclarativeBase):
return string return string
def __repr__(self): def __repr__(self):
return f"<Transaction {self.transaction_id} for User {self.user_id} {str(self)}>" return f"<Transaction {self.transaction_id} for User {self.user_id}>"
class Admin(TableDeclarativeBase): 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() joined_self = session.query(Order).filter_by(order_id=self.order_id).join(Transaction).one()
items = "" items = ""
for item in self.items: for item in self.items:
items += str(item) + "\n" items += item.text(loc=loc) + "\n"
if self.delivery_date is not None: if self.delivery_date is not None:
status_emoji = loc.get("emoji_completed") status_emoji = loc.get("emoji_completed")
status_text = loc.get("text_completed") status_text = loc.get("text_completed")

View file

@ -1129,9 +1129,11 @@ class Worker(threading.Thread):
self.session.commit() self.session.commit()
# Notify the user of the credit/debit # Notify the user of the credit/debit
self.bot.send_message(user.user_id, 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 # 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): def __help_menu(self):
"""Help menu. Allows the user to ask for assistance, get a guide or see some info about the bot.""" """Help menu. Allows the user to ask for assistance, get a guide or see some info about the bot."""