-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow scope names to be different from their value #641
Allow scope names to be different from their value #641
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core of the change is good, but there are some minor tweaks I want here. Specifically, after #643, I think we can fixup the sphinx extension to avoid using some of the internal names which you've preserved.
I'm testing a fix to the sphinx extension now:
diff --git a/src/globus_sdk/_sphinxext.py b/src/globus_sdk/_sphinxext.py
index c92d894..243bb51 100644
--- a/src/globus_sdk/_sphinxext.py
+++ b/src/globus_sdk/_sphinxext.py
@@ -13,7 +13,7 @@ from sphinx.util.nodes import nested_parse_with_titles
def _extract_known_scopes(scope_builder_name):
sb = locate(scope_builder_name)
- return sb._known_scopes
+ return sb._known_scope_names
It looks to me like this works.
(NB: I'm aware that there are no unit tests which enforce that the sphinx extension code handles objects correctly; maybe we should add some in the future.)
changelog.d/20221103_144520_derek_fix_specific_flow_scope_string.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great, but we have one final fix to apply, to the sphinx extension.
See the following screenshot of docs for AuthScopes:
doc build, scopes page
Where did the duplicates come from? (I knew they were there, which is why I went to the doc build. 😉 )
A failing of the ScopeBuilder
has been fixed. ScopeBuilder.scope_names
fetches the classattr scopes in addition to the instance-assigned scopes. This was missing in the past mechanism.
The scopes were being explicitly listed with add_scopes=...
. (I think the classattr list was added after the extension was written.)
The fast fix is to just do this:
.. listknownscopes:: globus_sdk.scopes.AuthScopes
- add_scopes=openid,email,profile
example_scope=view_identity_set
The optional thing to add on here is to remove the add_scopes=...
feature from the extension, but that can be done in a follow-up. I leave it to your discretion as the PR author whether you'd like us to do that in a separate PR or if you want to include it here.
Good catch on AuthScopes Stephen, I generated the docs locally after adding I'll update that in a new rev. |
ScopeBuilder
scope_value
.scope_name
to a less human understandablescope_value
to be formatted into either a urn or urlScopeBuilder.scope_names
property-
to_
hereTesting
^ this scope string is verified accurate above