Shadow lexicon title with fallback to name
This commit is contained in:
parent
7785d7cbf5
commit
ef9fe5c0e2
|
@ -44,6 +44,8 @@ class LexiconModel():
|
||||||
def __getattr__(self, key):
|
def __getattr__(self, key):
|
||||||
if key not in self.config:
|
if key not in self.config:
|
||||||
raise AttributeError(key)
|
raise AttributeError(key)
|
||||||
|
if key == 'title':
|
||||||
|
return self.config.get('title') or f'Lexicon {self.config.name}'
|
||||||
return self.config.get(key)
|
return self.config.get(key)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -57,7 +59,7 @@ class LexiconModel():
|
||||||
|
|
||||||
def add_log(self, message):
|
def add_log(self, message):
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
with json_rw(self.config_path) as j:
|
with self.edit() as j:
|
||||||
j['log'].append([now, message])
|
j['log'].append([now, message])
|
||||||
|
|
||||||
def status(self):
|
def status(self):
|
||||||
|
|
Loading…
Reference in New Issue