Skip to content

Commit

Permalink
updating check for public on update to take into account functions th…
Browse files Browse the repository at this point in the history
…at never had is public set
  • Loading branch information
jmoens committed Oct 30, 2024
1 parent bdb53ac commit f48a976
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tabpy/tabpy_server/management/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _check_and_set_dependencies(self, dependencies, defaultValue):
return dependencies

def _check_and_set_is_public(self, is_public, defaultValue):
logger.log(logging.INFO, f"set is_public")
if is_public is None:
return defaultValue

Expand Down Expand Up @@ -340,7 +341,12 @@ def update_endpoint(
endpoint_type, endpoint_info["type"])
dependencies = self._check_and_set_dependencies(
dependencies, endpoint_info.get("dependencies", []))
is_public = self._check_and_set_is_public(is_public, endpoint_info["is_public"])
# Adding is_public means that some existing functions do not have the is_public attribute set.
# We need to check for this when updating and set to False by default
current_is_public = False
if hasattr(endpoint_info, "is_public"):
current_is_public = endpoint_info["is_public"]
is_public = self._check_and_set_is_public(is_public, current_is_public)

self._check_target(target)
if target and target not in endpoints:
Expand Down

0 comments on commit f48a976

Please sign in to comment.