From bd14839af5cdf5ffd0ec0cede214da61130e027e Mon Sep 17 00:00:00 2001 From: computermacgyver Date: Thu, 26 Oct 2023 08:34:33 +0900 Subject: [PATCH] Clean diff for https://github.com/meedan/alegre/pull/342 --- app/main/lib/shared_models/shared_model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main/lib/shared_models/shared_model.py b/app/main/lib/shared_models/shared_model.py index 1f863386..2ec6035e 100644 --- a/app/main/lib/shared_models/shared_model.py +++ b/app/main/lib/shared_models/shared_model.py @@ -43,7 +43,9 @@ def get_servers(): @staticmethod def get_client(model_key, options={}): r = redis.Redis(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'], db=app.config['REDIS_DATABASE']) - model_class = json.loads(r.get('SharedModel:%s' % model_key).decode('utf-8'))['model_class'] + model_info = r.get("SharedModel:%s" % model_key) + assert model_info is not None, f"Unable locate model info for key {model_key}" + model_class = json.loads(model_info.decode('utf-8'))['model_class'] class_ = SharedModel.import_model_class(model_class) return class_(model_key, options)