Пример #1
0
def get(setting_name = None):
    user = authentication.get_current_user()
    if setting_name:
        setting_list = [settingsHandler.get_setting(user.get('burner_sn'), setting_name)]
    else:
        setting_list = settingsHandler.get_settings(user.get('burner_sn'), user.get('role'))

    payload = {'settings': setting_list}

    return OkResponse(payload) if len(setting_list) > 0 else ConflictResponse(payload)
Пример #2
0
def handleUpdate(msg):
    table = msg['table']
    data = json.loads(msg['data'])
    installation = msg['installation']

    if table == 'settings':
        if config.LOCAL:
            current_setting = settingsHandler.get_setting(installation, data['setting_name'])
            prev = json.loads(msg['prev'])
            if prev != current_setting:
                send_correction_ack(msg['id'], installation, current_setting)
                return False
            else:
                settingsHandler.update_setting(data, installation, False)
        else:
            settingsHandler.update_setting(data, installation, False)
    else:
        print("ERROR: Unsupported table: %s" % (table))

    return True