From f59716e0960a7bab0bef68e515731c3d1bc9fac9 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 15 Jan 2020 17:16:09 -0800 Subject: [PATCH] Add user getattr to make config access easier --- amanuensis/user.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/amanuensis/user.py b/amanuensis/user.py index ad85497..54f74d1 100644 --- a/amanuensis/user.py +++ b/amanuensis/user.py @@ -17,6 +17,11 @@ class User(UserMixin): with config.json_ro(self.config_path) as 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): return self.uid