Add user getattr to make config access easier
This commit is contained in:
parent
634c00ae53
commit
f59716e096
|
@ -17,6 +17,11 @@ class User(UserMixin):
|
||||||
with config.json_ro(self.config_path) as j:
|
with config.json_ro(self.config_path) as j:
|
||||||
self.config = j
|
self.config = j
|
||||||
|
|
||||||
|
def __getattr__(self, key):
|
||||||
|
if key not in self.config:
|
||||||
|
raise AttributeError(key)
|
||||||
|
return self.config.get(key)
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
return self.uid
|
return self.uid
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue