generated from nathanwoodburn/python-webserver-template
feat: Fix some errors with listing formatting
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
This commit is contained in:
10
sales.py
10
sales.py
@@ -26,7 +26,17 @@ class Listing:
|
||||
for key, value in kwargs.items():
|
||||
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())
|
||||
print(str(self))
|
||||
|
||||
def __str__(self):
|
||||
return f"Domain: {self.domain}\nPrice: {self.price}\nDescription: {self.description}\nContact: {self.contact}"
|
||||
|
||||
Reference in New Issue
Block a user