feat: Fix some errors with listing formatting
All checks were successful
Build Docker / BuildImage (push) Successful in 37s

This commit is contained in:
2025-01-30 18:30:49 +11:00
parent d5b2f4f975
commit 6061f8ed5d

View File

@@ -26,7 +26,17 @@ class Listing:
for key, value in kwargs.items(): for key, value in kwargs.items():
setattr(self, key, value) setattr(self, key, value)
self.price = int(self.price)
# Fix any errors in the data
if self.price < 0:
self.price = 0
self.description = self.description.replace('\n','')
self.description = self.description.replace('\r','')
self.description = self.description.strip()
self.contact = self.contact.replace('\n','')
self.updated = int(time.time()) self.updated = int(time.time())
print(str(self))
def __str__(self): def __str__(self):
return f"Domain: {self.domain}\nPrice: {self.price}\nDescription: {self.description}\nContact: {self.contact}" return f"Domain: {self.domain}\nPrice: {self.price}\nDescription: {self.description}\nContact: {self.contact}"