Fix user_id modification and add warning
This commit is contained in:
parent
c53775ddf9
commit
2c6962b86d
1 changed files with 4 additions and 3 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
import ast
|
import ast
|
||||||
import operator
|
import operator
|
||||||
|
import warnings
|
||||||
from typing import Any, ClassVar, Optional
|
from typing import Any, ClassVar, Optional
|
||||||
|
|
||||||
from cachetools import TTLCache, cachedmethod
|
from cachetools import TTLCache, cachedmethod
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
|
||||||
from langflow.interface.custom.code_parser import CodeParser
|
from langflow.interface.custom.code_parser import CodeParser
|
||||||
from langflow.utils import validate
|
from langflow.utils import validate
|
||||||
|
|
||||||
|
|
@ -32,7 +32,8 @@ class Component:
|
||||||
|
|
||||||
def __setattr__(self, key, value):
|
def __setattr__(self, key, value):
|
||||||
if key == "user_id" and hasattr(self, key):
|
if key == "user_id" and hasattr(self, key):
|
||||||
raise AttributeError("Modification of user_id is not allowed")
|
warnings.warn("Modification of user_id is not allowed")
|
||||||
|
else:
|
||||||
super().__setattr__(key, value)
|
super().__setattr__(key, value)
|
||||||
|
|
||||||
@cachedmethod(cache=operator.attrgetter("cache"))
|
@cachedmethod(cache=operator.attrgetter("cache"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue