-
Notifications
You must be signed in to change notification settings - Fork 25
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
Make navigate() and navigate_url() auto-authenticate for embargoed Dandisets #870
Conversation
Codecov Report
@@ Coverage Diff @@
## master #870 +/- ##
==========================================
- Coverage 86.60% 86.53% -0.08%
==========================================
Files 58 58
Lines 6071 6097 +26
==========================================
+ Hits 5258 5276 +18
- Misses 813 821 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
minor requests:
- adjust docstrings to not limit to embargoed
- ideally -- remove code duplication?
client.dandi_authenticate() | ||
assets = list(self.get_assets(client, strict=strict)) | ||
else: | ||
raise |
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.
we were in a similar position somewhere else with code duplication, but forgot how we solved it (if we did) -- feels like needing some helper/decorator but its operation would depend on the value of authenticate
kwarg. I guess decorator could get
it from the invocation's kwargs
(and better to position strict and authenticate after *
to ensure use of kwarg instead of posarg). Also relating to the suggestion for docstring, it is just an assumption that it is "embargoed" if 401
-- might be some new feature or a bug etc whenever API would return 401 so might be better to adjust log message to correspond situation better.
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.
I don't feel the code is repeated enough to warrant the complexity of adding a decorator.
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
Closes #867.
Nonfunctional without dandi/dandi-archive#831.