From 068c27a2b43fad83bbdecd80f4c6d9353d7db4c6 Mon Sep 17 00:00:00 2001 From: Casey Schneider-Mizell Date: Wed, 11 Dec 2024 12:22:26 -0800 Subject: [PATCH 1/2] fix: ngl_url not passed all places --- src/nglui/statebuilder/helpers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/nglui/statebuilder/helpers.py b/src/nglui/statebuilder/helpers.py index 1aae67b..78a9087 100644 --- a/src/nglui/statebuilder/helpers.py +++ b/src/nglui/statebuilder/helpers.py @@ -387,7 +387,11 @@ def make_state_url( Url to the uploaded neuroglancer state. """ state = sb.render_state( - df, return_as="dict", target_site=target_site, config_key=config_key + df, + return_as="dict", + url_prefix=ngl_url, + target_site=target_site, + config_key=config_key, ) state_id = client.state.upload_state_json(state) if ngl_url is None: @@ -402,7 +406,7 @@ def make_url_robust( df: pd.DataFrame, sb: StateBuilder, client: CAVEclient, - shorten: str = "if_long", + shorten: Literal["if_long", "always", "never"] = "if_long", ngl_url: str = None, max_url_length=MAX_URL_LENGTH, target_site=None, @@ -433,6 +437,8 @@ def make_url_robust( Type of neuroglancer deployment to build link for, by default None. This value overrides automatic checking based on the provided url. Use `seunglab` for a Seung-lab branch and either `mainline` or `cave-explorer` for the Cave Explorer or main Google branch. + config_key : str + Which site config you want to use. Returns ------- @@ -512,7 +518,7 @@ def package_state( HTML, str or dict state in format specified by return_as """ - if (return_as == "html") or (return_as == "url") or (return_as == "short"): + if return_as in ["html", "url", "short"]: if return_as == "short": return_as = "url" shorten = "always" From efdfb7ae9cb6ff6cf8f5249308f7ed7e48f1bad3 Mon Sep 17 00:00:00 2001 From: Casey Schneider-Mizell Date: Wed, 11 Dec 2024 12:29:09 -0800 Subject: [PATCH 2/2] add client as well for robustness --- src/nglui/statebuilder/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nglui/statebuilder/helpers.py b/src/nglui/statebuilder/helpers.py index 78a9087..8a53d49 100644 --- a/src/nglui/statebuilder/helpers.py +++ b/src/nglui/statebuilder/helpers.py @@ -390,6 +390,7 @@ def make_state_url( df, return_as="dict", url_prefix=ngl_url, + client=client, target_site=target_site, config_key=config_key, )