Skip to content

Conversation

@johanlundberg
Copy link
Contributor

@johanlundberg johanlundberg commented Oct 18, 2018

I was apparently confused in my last PR (#550) when I tried to fix the response class __str__.

This should (hopefully) be the correct way of handling a response string containing non ascii characters.

All Submissions:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what problem you are trying to solve with this PR?
  • Have you added information on what your changes do and why you chose this as your solution?
  • Have you written new tests for your changes?
  • Does your submission pass tests?
  • This project follows PEP8 style guide. Have you run your code against the 'flake8' linter?

@c00kiemon5ter
Copy link
Member

I have filled issue #2902 with PyPy3 for the failing build.

if six.PY2:
return str(self.xmlstr).decode('utf-8')
else:
return str(self.xmlstr)
Copy link
Member

Choose a reason for hiding this comment

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

self.xmlstr should always be a str. str(self.xmlstr) will always result to the same value as self.xmlstr. str(...) shouldn't be needed here.

Copy link
Contributor Author

@johanlundberg johanlundberg Oct 19, 2018

Choose a reason for hiding this comment

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

I agree, but is it a should or would ;). I will update my PR as I can't find any way for self.xmlstr to be anything other than a string as you say.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We where not quite right as self.xmlstr can be bytes when using Python 3.x. The test that was failing was test_flow in test_65_authn_query.

@johanlundberg johanlundberg force-pushed the non_ascii_ava_encryption_decryption branch from de92b7a to b62528b Compare October 19, 2018 07:57
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@c00kiemon5ter c00kiemon5ter merged commit ab2c644 into IdentityPython:master Oct 23, 2018
@c00kiemon5ter
Copy link
Member

c00kiemon5ter commented Oct 23, 2018

I merged this, ignoring the failing case for pypy3. There is nothing we can do about it. It is up to travis-ci to update their image and upgrade pypy3 to a stable version. For reference Python 3.5.3[pypy-6.0.0-final] works fine.

As for the PR itself, I opted to store xmlstr in the correct type when it is initialized. That way there is no need to check again what should be done.

@johanlundberg
Copy link
Contributor Author

Sounds good. Thank you!

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.

2 participants