Skip to content

Commit

Permalink
Revert "RF: make needs_authentication into a bool"
Browse files Browse the repository at this point in the history
This reverts commit c936ed3.

I think there was some thought behind initial code since "else" clause does
cause entry of credential if there is a no known credential and we do not
know by then (thus None) if needs_authentication (would be bool) if there is no
authenticator assigned.

So to not disturb that portion of the code, I am reverting the change
which was incomplete anyways since logic in "else:" would no longer trigger
nested else: to entry of credential.
  • Loading branch information
yarikoptic committed Sep 20, 2020
1 parent 768993f commit 50a0b10
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions datalad/downloaders/base.py
Expand Up @@ -137,7 +137,7 @@ def access(self, method, url, allow_old_session=True, **kwargs):
if authenticator:
needs_authentication = authenticator.requires_authentication
else:
needs_authentication = self.credential is None
needs_authentication = self.credential
attempt, incomplete_attempt = 0, 0
result = None
while True:
Expand Down Expand Up @@ -242,7 +242,7 @@ def _handle_authentication(self, url, needs_authentication, e,
auth_types=supported_auth_types,
new_provider=False)
else: # None or False
if not needs_authentication:
if needs_authentication is False:
# those urls must or should NOT require authentication
# but we got denied
raise DownloadError(
Expand All @@ -251,6 +251,8 @@ def _handle_authentication(self, url, needs_authentication, e,
"Adjust your configuration for the provider.%s"
% (url, msg_types))
else:
# how could be None or any other non-False bool(False)
assert (needs_authentication is None)
# So we didn't know if authentication necessary, and it
# seems to be necessary, so Let's ask the user to setup
# authentication mechanism for this website
Expand Down

0 comments on commit 50a0b10

Please sign in to comment.