str/repr changes

This commit is contained in:
Tim Van Baak 2020-01-29 14:35:19 -08:00
parent e9142a7f56
commit 027933b645
2 changed files with 7 additions and 1 deletions

View File

@ -46,6 +46,12 @@ class LexiconModel():
raise AttributeError(key) raise AttributeError(key)
return self.config.get(key) return self.config.get(key)
def __str__(self):
return '<Lexicon {0.name}>'.format(self)
def __repr__(self):
return '<LexiconModel lid={0.id} name={0.name}>'.format(self)
def log(self, message): def log(self, message):
now = int(time.time()) now = int(time.time())
with json_rw(self.config_path) as j: with json_rw(self.config_path) as j:

View File

@ -50,7 +50,7 @@ class UserModel(UserMixin):
return self.config.get(key) return self.config.get(key)
def __str__(self): def __str__(self):
return '<UserModel {}>'.format(self.username) return '<{0.username}>'.format(self)
def __repr__(self): def __repr__(self):
return '<UserModel uid={0.id} username={0.username}>'.format(self) return '<UserModel uid={0.id} username={0.username}>'.format(self)