def save_preset(): if request.method == 'POST': preset_number = presets.save_new_preset() preset = utility.get_preset_by_number(preset_number) utility.write_config('Configuration', 'current_preset', preset['preset_name']) message = 'Saved preset!' data = { 'message': message, 'preset_number': preset['preset_number'], 'icon_class': preset['icon_class'] } return jsonify(data)