We should try to convert the variable first but not to raise an unnecessary exception. #816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since i pass the dict object with str and int object, an exception will be raised.
The related code is here: https://code.google.com/p/gabr/source/browse/application/views/status.py?r=c67d65b90bdf78d07d4fe92cc1e8f9827cb5eaf8#22
So i must unicode the parameters first: https://code.google.com/p/gabr/source/browse/application/views/status.py?r=7eb65d488db14fb1ced0c848c0334f894191ab7b#20
It's caused by https://github.com/kennethreitz/requests/blob/9576518d69b819b25cd036397d2624daa6ae088c/requests/packages/oauthlib/oauth1/rfc5849/utils.py#L52 which will check the type of the parameters.
But i think it's not necessary, because what common.quote do is that it encode the unicode string to utf8, call urllib.quote and decode it. I think even this unicode intermediate object is unnecessary, because the only calling is from https://github.com/kennethreitz/requests/blob/9576518d69b819b25cd036397d2624daa6ae088c/requests/packages/oauthlib/oauth1/rfc5849/signature.py#L373 which convert the object to unicode string again in the next statement.
And i think common.quote is unncessary, because the only calling is from oauth1/rfc5849/utils.py , the rest in this package is directly calling urllib.quote.
So i think, we should just encoding it if it's a unicode object or do nothing else.