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

add py3 compatibility to wsgi docstring example #78

Merged
merged 1 commit into from Mar 12, 2018

Conversation

Projects
None yet
2 participants
@jaymcgrath
Contributor

jaymcgrath commented Mar 11, 2018

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Bug fix

  • What is the related issue number (starting with #)
    fixes #77

  • What is the current behavior? (You can also link to an open issue here)
    A WSGI application iterable is supposed to return byte strings for response body. If it returns Unicode strings it is an error.

A WSGI server is not meant to convert Unicode strings to byte strings automatically.

The example Hello World server in the wsgi.py docstring fails with a ValueError: WSGI Applications must yield bytes in Python 3. This is because in Python 3, all strings are unicode by default.

This behavior can be disappointing and confusing for newcomers testing out cheroot.

  • What is the new behavior (if this is a feature change)?
    Return bytes instead of unicode. I added a "b" ! :)

  • Other information:
    Cheers!

@codecov

This comment has been minimized.

codecov bot commented Mar 11, 2018

Codecov Report

Merging #78 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #78   +/-   ##
=======================================
  Coverage   65.67%   65.67%           
=======================================
  Files          15       15           
  Lines        2753     2753           
=======================================
  Hits         1808     1808           
  Misses        945      945
@webknjaz

Thanks!

@webknjaz webknjaz merged commit 018a850 into cherrypy:master Mar 12, 2018

8 checks passed

WIP ready for review
Details
ci/circleci: linux-build Your tests passed on CircleCI!
Details
ci/circleci: macos-build Your tests passed on CircleCI!
Details
codeclimate All good!
Details
codecov/patch Coverage not affected when comparing b42cd7d...6f54a24
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
lgtm analysis: Python No alert changes
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment