From b2600b76a6dba0ae5da189b87b2e889577a33019 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Wed, 25 Dec 2024 22:44:09 +0530 Subject: [PATCH] fix: Workspace.DoesNotExist User must be logged in to get their workspace on functions recipe --- recipes/Functions.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/recipes/Functions.py b/recipes/Functions.py index 59edd6082..794c77728 100644 --- a/recipes/Functions.py +++ b/recipes/Functions.py @@ -14,6 +14,7 @@ from functions.models import CalledFunction, VariableSchema from managed_secrets.models import ManagedSecret from managed_secrets.widgets import edit_secret_button_with_dialog +from workspaces.models import Workspace class ConsoleLogs(BaseModel): @@ -145,14 +146,16 @@ def render_variables(self): help=field_desc(self.RequestModel, "secrets"), unsafe_allow_html=True, ) - edit_secret_button_with_dialog( - self.current_workspace, - self.request.user, - trigger_label=f"{icons.add} Add", - trigger_type="tertiary", - trigger_className="p-1 mb-2", - ) - + try: + edit_secret_button_with_dialog( + self.current_workspace, + self.request.user, + trigger_label=f"{icons.add} Add", + trigger_type="tertiary", + trigger_className="p-1 mb-2", + ) + except Workspace.DoesNotExist: + pass options = list( set( self.current_workspace.managed_secrets.order_by(