tornadoweb / tornadoweb/tornado
function based wsgi container and return value bytes expected
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
In going through the docs, i saw a snippet to test a wsgi container, and ran as-is in a fresh environment. What i encountered was an error related to the docs such that the return value did not encode to bytes to send as the output of the WSGI container rudimentary function. Specifically, in https://www.tornadoweb.org/en/stable/wsgi.html
import tornado
import tornado.wsgi
import tornado.httpserver
import tornado.ioloop
def simple_app(environ, start_response):
status = "200 OK"
response_headers = [("Content-type", "text/plain")]
start_response(status, response_headers)
return ["Hello world!\n"]
container = tornado.wsgi.WSGIContainer(simple_app)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(8888)
tornado.ioloop.IOLoop.current().start()
The fix i applied was to change
return ["Hello world!\n"]
into
return ["Hello world!\n".encode("utf-8")]
Would a docs update suffice to contain this? Worth putting in a doc test? I would be a first time contributor here for the PR if so.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WSGI example at the documentation URL named in the issue and verify its return value against the WSGI bytes requirement. Done means the published example runs successfully in a fresh environment; the payload does not name a documentation file or test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100