From 016da90cd1d0b367028405827b9234114f2cc3c5 Mon Sep 17 00:00:00 2001 From: Pavol Date: Mon, 24 Nov 2025 18:06:14 +0100 Subject: [PATCH 1/2] fix: required for functional app --- .../queries/node_context_requests_backend.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/forloop_modules/queries/node_context_requests_backend.py b/forloop_modules/queries/node_context_requests_backend.py index 2c39c06..6e8017e 100644 --- a/forloop_modules/queries/node_context_requests_backend.py +++ b/forloop_modules/queries/node_context_requests_backend.py @@ -1025,6 +1025,22 @@ def get_user_logs() -> Response: response = http_client.get(url) return response +############### In app Console logs ############### +def post_console_log(message: str, type: str = "print"): + + payload = { + "message": message, + "project_uid": aet.project_uid, + "type": type + } + + url = f"{BASE_API}/console_logs" + return http_client.post(url, json=payload) + +def get_console_logs() -> Response: + url = f"{BASE_API}/console_logs" + response = http_client.get(url) + return response ############### In app Console logs ############### From 981e98895f223819616a4135b7b38a104df5400b Mon Sep 17 00:00:00 2001 From: Pavol Date: Mon, 24 Nov 2025 18:13:46 +0100 Subject: [PATCH 2/2] fix: additional code to PR --- .../function_handlers/variable_handlers.py | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/forloop_modules/function_handlers/variable_handlers.py b/forloop_modules/function_handlers/variable_handlers.py index e4c6b37..51366a9 100644 --- a/forloop_modules/function_handlers/variable_handlers.py +++ b/forloop_modules/function_handlers/variable_handlers.py @@ -1202,7 +1202,7 @@ def direct_execute(self, variable_name): def input_execute(self, inp): var_name = inp("variable_name") var_obj = variable_handler.variables.get(var_name) - + if var_obj is not None: #message = f'PrintVariable: {var_name} = {var_obj.value}' ##Optional Variable printing format message = f'{var_obj.value}' @@ -1211,7 +1211,6 @@ def input_execute(self, inp): # message = f'PrintVariable: {var_name}' ##Optional Variable printing format message = f'{var_name}' - # Send to FastAPI backend try: ncrb.post_console_log(message=message, type="print") @@ -1228,16 +1227,36 @@ def execute(self, node_detail_form): self.direct_execute(variable_name) - def export_code(self, *args): - """TODO""" - code = """ """ - + def export_code(self, node_detail_form): + """ + Export Python code for print statement. + """ + variable_name = node_detail_form.get_chosen_value_by_name("variable_name", variable_handler) + code = f"print({variable_name})" return code + def make_flpl_node_dict(self, line_dict: dict) -> dict: + """ + Custom method to properly handle print statements. + Maps the first argument to variable_name parameter. + """ + node_dict = {"type": self.icon_type, "params": {}} + + # Get the first argument (what to print) + arguments = line_dict.get("arguments", []) + first_arg = arguments[0] if arguments else "" + + # Set the variable_name parameter + node_dict["params"]["variable_name"] = {"variable": None, "value": first_arg} + + return node_dict + def export_imports(self, *args): - """TODO""" + """ + Export imports needed for print functionality. + Print is a built-in Python function, so no imports are needed. + """ imports = [] - return imports