refac
This commit is contained in:
1 parent
646a568ae6
commit
a3a81fee03
1 file changed
+9
@@ -593,6 +593,9 @@ async def get_function_user_valves_spec_by_id(
|
|||||||
):
|
):
|
||||||
function = await Functions.get_function_by_id(id, db=db)
|
function = await Functions.get_function_by_id(id, db=db)
|
||||||
if function:
|
if function:
|
||||||
|
if not function.is_active:
|
||||||
|
return None
|
||||||
|
|
||||||
function_module, function_type, frontmatter = await get_function_module_from_cache(request, id)
|
function_module, function_type, frontmatter = await get_function_module_from_cache(request, id)
|
||||||
|
|
||||||
if hasattr(function_module, 'UserValves'):
|
if hasattr(function_module, 'UserValves'):
|
||||||
@@ -620,6 +623,12 @@ async def update_function_user_valves_by_id(
|
|||||||
function = await Functions.get_function_by_id(id, db=db)
|
function = await Functions.get_function_by_id(id, db=db)
|
||||||
|
|
||||||
if function:
|
if function:
|
||||||
|
if not function.is_active:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail='Function is not active',
|
||||||
|
)
|
||||||
|
|
||||||
function_module, function_type, frontmatter = await get_function_module_from_cache(request, id)
|
function_module, function_type, frontmatter = await get_function_module_from_cache(request, id)
|
||||||
|
|
||||||
if hasattr(function_module, 'UserValves'):
|
if hasattr(function_module, 'UserValves'):
|
||||||
|
|||||||
Reference in new issue
Block a user