From 72d56d9b63d7bf45087aca4d41a7a45d2bec858b Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 12 Sep 2025 08:25:16 +0200 Subject: [PATCH] auth.Auth.load(): Move type argument into config Auth.load() takes a "tp" argument, specifying the Auth module name to load. In case of jw-devops, this is part of the configuration, which is also passed as an argument. Make taking 'type' from the config the default. Note that this changes the prototype. Signed-off-by: Jan Lindemann --- tools/python/jwutils/auth/Auth.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/python/jwutils/auth/Auth.py b/tools/python/jwutils/auth/Auth.py index 82396b9..01106aa 100644 --- a/tools/python/jwutils/auth/Auth.py +++ b/tools/python/jwutils/auth/Auth.py @@ -72,7 +72,13 @@ class User: # export class Auth(abc.ABC): # export @classmethod - def load(cls, tp: str, conf: Config) -> Self: + def load(cls, conf: Config, tp: str='') -> Self: + if tp == '': + tp = conf.get('type') + if tp is None: + msg = f'No type specified in auth configuration' + conf.dump(ERR, msg) + raise Exception(msg) return load_object(f'jwutils.auth.{tp}.Auth', Auth, 'Auth', conf) def __init__(self, conf: Config):