Muawiya-contact commented on code in PR #325:
URL: https://github.com/apache/hugegraph-ai/pull/325#discussion_r3208596275
##########
hugegraph-python-client/src/pyhugegraph/utils/huge_router.py:
##########
@@ -126,7 +126,27 @@ def wrapper(self: "HGraphContext", *args: Any, **kwargs:
Any) -> Any:
all_kwargs = dict(bound_args.arguments)
# Remove 'self' from the arguments used to format the pathinfo
all_kwargs.pop("self")
- formatted_path = path.format(**all_kwargs)
+
+ # Support graphspace-scoped paths: prefer graphspace-prefixed
path
+ # but gracefully fall back to server-level /auth/... if
graphspace
+ # is not configured or the server does not support graphspaces.
+ if "{graphspace}" in path:
+ # Prefer explicit graphspace argument passed by caller
+ graphspace_arg = all_kwargs.get("graphspace")
+ graphspace_cfg = getattr(self.session.cfg, "graphspace",
None)
+ gs_supported = getattr(self.session.cfg, "gs_supported",
False)
+
+ # Use graphspace if available and server supports it
+ if graphspace_arg or (graphspace_cfg and gs_supported):
+ all_kwargs.setdefault("graphspace", graphspace_arg or
graphspace_cfg)
Review Comment:
Good catch — switching to direct assignment. `setdefault` was the wrong
primitive here since `apply_defaults() `pre-populates the key with `None.`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]