__get_model_config.py 561 Bytes
Newer Older
1
from general.api import get_api_config
2 3


4
def get_model_config(model):
5 6 7 8
    api_config = get_api_config()

    for obj in api_config:
        if obj['model'] == model:
9
            tmp = {
Florent Chehab's avatar
Florent Chehab committed
10
                "moderation_level": obj["moderation_level"],
11 12
                "model": model,
                "read_only": obj["read_only"]
Florent Chehab's avatar
Florent Chehab committed
13
            }
14 15 16 17
            key = 'enforce_moderation_user_level'
            if key in obj.keys():
                tmp[key] = obj[key]
            return tmp
18 19

    raise Exception("Model not found in API configuraiton, cannot process !")