Skip to content
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

Fix deprecation warnings. #53

Merged
merged 3 commits into from
Jan 27, 2018
Merged

Fix deprecation warnings. #53

merged 3 commits into from
Jan 27, 2018

Conversation

icemac
Copy link
Member

@icemac icemac commented Jan 25, 2018

Fixed the ones which have shown up when running the tests in the way the warning suggested it.

Fixed the ones which have shown up when running the tests in the way the warning suggested it.
@@ -111,7 +114,7 @@ def _doDelUsers(self, names):
def identify(self, auth):
if auth and auth.lower().startswith('basic '):
try:
name, password = decodestring(auth.split(' ')[-1].encode()).decode() \
name, password = decodebytes(auth.split(' ')[-1].encode()).decode() \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just compared auth against native str above: are you confident it is really bytes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the documentation (https://docs.python.org/3/library/base64.html#base64.decodestring) base64.decodestring is a deprecated alias of decodebytes. I think at least my change does not make the code worse.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but if the Python3 stdlib is expecting bytes, we shouldn't be passing in auth as text, nor comparing / splitting it with str constants.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #56 to track this issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tseaver Thank you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ad391da

@icemac
Copy link
Member Author

icemac commented Jan 26, 2018

Green Travis CI depends on merging #55 into this branch.

@icemac icemac merged commit 1bebd89 into master Jan 27, 2018
@icemac icemac deleted the fix-deprecations branch January 27, 2018 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants