Skip to content

Commit

Permalink
Fix simple example from the documentation (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Feb 10, 2024
1 parent 59543a4 commit 8505ad4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ in a simple WSGI application::

# The following two callbacks just append the name to the return value.
def on_field(field):
ret.append("Parsed field named: %s" % (field.field_name,))
ret.append(b"Parsed field named: %s" % (field.field_name,))

def on_file(file):
ret.append("Parsed file named: %s" % (file.field_name,))
ret.append(b"Parsed file named: %s" % (file.field_name,))

# Create headers object. We need to convert from WSGI to the actual
# name of the header, since this library does not assume that you are
Expand All @@ -40,10 +40,12 @@ in a simple WSGI application::

# Return something.
start_response('200 OK', [('Content-type', 'text/plain')])
ret.append('\n')
ret.append(b'\n')
return ret

from wsgiref.simple_server import make_server
from wsgiref.validate import validator

httpd = make_server('', 8123, simple_app)
print("Serving on port 8123...")
httpd.serve_forever()
Expand Down

0 comments on commit 8505ad4

Please sign in to comment.