From 2c6962b86deff8341a8977f32f0560081a82ac53 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 24 Nov 2023 11:21:24 -0300 Subject: [PATCH] Fix user_id modification and add warning --- src/backend/langflow/interface/custom/component.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/custom/component.py b/src/backend/langflow/interface/custom/component.py index bc4b4e605..420a62a85 100644 --- a/src/backend/langflow/interface/custom/component.py +++ b/src/backend/langflow/interface/custom/component.py @@ -1,10 +1,10 @@ import ast import operator +import warnings from typing import Any, ClassVar, Optional from cachetools import TTLCache, cachedmethod from fastapi import HTTPException - from langflow.interface.custom.code_parser import CodeParser from langflow.utils import validate @@ -32,8 +32,9 @@ class Component: def __setattr__(self, key, value): if key == "user_id" and hasattr(self, key): - raise AttributeError("Modification of user_id is not allowed") - super().__setattr__(key, value) + warnings.warn("Modification of user_id is not allowed") + else: + super().__setattr__(key, value) @cachedmethod(cache=operator.attrgetter("cache")) def get_code_tree(self, code: str):