comparison mercurial/hgweb/request.py @ 34512:482d6f6dba91

hgweb: when constructing or adding to a wsgi environ dict, use native strs That's what's required of us to work with the WSGI API on Python 3. Differential Revision: https://phab.mercurial-scm.org/D967
author Augie Fackler <augie@google.com>
date Thu, 05 Oct 2017 14:22:02 -0400
parents 37fcfe52c68c
children 34fcb0f66837
comparison
equal deleted inserted replaced
34511:67873ec0f4ce 34512:482d6f6dba91
57 WSGI applications are invoked with 2 arguments. They are used to 57 WSGI applications are invoked with 2 arguments. They are used to
58 instantiate instances of this class, which provides higher-level APIs 58 instantiate instances of this class, which provides higher-level APIs
59 for obtaining request parameters, writing HTTP output, etc. 59 for obtaining request parameters, writing HTTP output, etc.
60 """ 60 """
61 def __init__(self, wsgienv, start_response): 61 def __init__(self, wsgienv, start_response):
62 version = wsgienv['wsgi.version'] 62 version = wsgienv[r'wsgi.version']
63 if (version < (1, 0)) or (version >= (2, 0)): 63 if (version < (1, 0)) or (version >= (2, 0)):
64 raise RuntimeError("Unknown and unsupported WSGI version %d.%d" 64 raise RuntimeError("Unknown and unsupported WSGI version %d.%d"
65 % version) 65 % version)
66 self.inp = wsgienv['wsgi.input'] 66 self.inp = wsgienv[r'wsgi.input']
67 self.err = wsgienv['wsgi.errors'] 67 self.err = wsgienv[r'wsgi.errors']
68 self.threaded = wsgienv['wsgi.multithread'] 68 self.threaded = wsgienv[r'wsgi.multithread']
69 self.multiprocess = wsgienv['wsgi.multiprocess'] 69 self.multiprocess = wsgienv[r'wsgi.multiprocess']
70 self.run_once = wsgienv['wsgi.run_once'] 70 self.run_once = wsgienv[r'wsgi.run_once']
71 self.env = wsgienv 71 self.env = wsgienv
72 self.form = normalize(cgi.parse(self.inp, 72 self.form = normalize(cgi.parse(self.inp,
73 self.env, 73 self.env,
74 keep_blank_values=1)) 74 keep_blank_values=1))
75 self._start_response = start_response 75 self._start_response = start_response