Browse Source

Added one tip to use this pattern in Python3.

pull/2982/head
Bernardo Gomes 6 years ago
parent
commit
98d5d21116
  1. 2
      docs/patterns/methodoverrides.rst

2
docs/patterns/methodoverrides.rst

@ -29,7 +29,7 @@ This can easily be accomplished with an HTTP middleware::
def __call__(self, environ, start_response):
method = environ.get('HTTP_X_HTTP_METHOD_OVERRIDE', '').upper()
if method in self.allowed_methods:
method = method.encode('ascii', 'replace')
method = method.encode('ascii', 'replace')# Remove this line if you are using Python3.
environ['REQUEST_METHOD'] = method
if method in self.bodyless_methods:
environ['CONTENT_LENGTH'] = '0'

Loading…
Cancel
Save