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

Support Python 3 #56

Merged
merged 3 commits into from Oct 23, 2012
Merged

Support Python 3 #56

merged 3 commits into from Oct 23, 2012

Conversation

mikix
Copy link

@mikix mikix commented Aug 31, 2012

These are mostly unicode string related changes and a few syntax ones. The diff is a bear to read because of all the minor u's' -> 's' changes. :(

#55

Tests pass under both Python2.7 and Python3.2. I don't happen to have a machine with 2.6 on it available right now. I will test later with 2.6.

The only thing I would qualify as a Change was in test_signatures.py:test_collect_parameters(), I made all the inputs unicode. The old code path worked in Python2 because it's a bit looser. But not in Python3, because 's' != b's'.

I had a hard time telling whether, as a matter of API, collect_parameters required its inputs to be unicode or not, but I assumed it did since so many other bits of API seemed to require that. But if I was wrong, I can go back and fix up that whole code path to work under both encoding (and spit out the same as it was given).

These are mostly unicode string related changes and a few syntax ones.

oauthlib#55
@travisbot
Copy link

This pull request fails (merged 95c2463 into dcbc028).

@mikix
Copy link
Author

mikix commented Aug 31, 2012

Uh. I seemed to have created a new issue, sorry. I'm not super familiar with github.

@travisbot
Copy link

This pull request fails (merged d06f017 into dcbc028).

@mikix
Copy link
Author

mikix commented Sep 3, 2012

OK, I've fixed 2.6 support. You shouldn't need Six. The difficulty of this port was mostly changing from Python2's bytes-by-default to Python3's unicode-by-default. Six won't really help with that (though it does give you u() and b() functions as syntactic sugar). I did mimic Six's unicode_type and bytes_type in common.py though.

I'd appreciate a review of this branch, it's ready now. I'll close out the other issue, since this one has the code.

@travisbot
Copy link

This pull request passes (merged 56a5c73 into dcbc028).

@ib-lundgren
Copy link
Collaborator

Great work! Will try and look into this during the weekend if none beats me to it.

@mikix
Copy link
Author

mikix commented Sep 10, 2012

FYI, I pushed this patch to Ubuntu. So it should be getting some real world testing.

@ib-lundgren
Copy link
Collaborator

Sorry for taking ages to get to this. I had a look this morning and found some minor unittest glitches in 3.1 and 3.3, the former lacking assertIsInstance and the latter making string comparisons based on dict ordering invalid (yea our tests needs some love). Will try and sort that out tonight. 2.6, 2.7 and 3.2 =)

@ib-lundgren ib-lundgren merged commit 56a5c73 into oauthlib:master Oct 23, 2012
@ib-lundgren
Copy link
Collaborator

Thanks once again for this! I've monkey patched in assertIsInstance into TestCase for 3.1 and the 3.3 issues are in #62.

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.

None yet

3 participants