diff options
author | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-10-12 16:04:40 +0800 |
---|---|---|
committer | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-10-12 16:04:40 +0800 |
commit | 4140e678f45b78cae67cbd4d6d5ac43ffe347ee9 (patch) | |
tree | d9629d0b153d74666e77e12f66c0206dbd5577e1 /share/tools/web_config | |
parent | cc0fcdc18dd6ef95775c70e65743dc6656373bf3 (diff) |
web_config: further python2/3 unification
Diffstat (limited to 'share/tools/web_config')
-rwxr-xr-x | share/tools/web_config/webconfig.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 734b428a..e63fe37e 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -772,18 +772,12 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): return self.send_error(403) self.path = p - if IS_PY2: - ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) - else: # Python 3 - ctype, pdict = cgi.parse_header(self.headers['content-type']) + ctype, pdict = cgi.parse_header(self.headers['content-type']) if ctype == 'multipart/form-data': postvars = cgi.parse_multipart(self.rfile, pdict) elif ctype == 'application/x-www-form-urlencoded': - try: - length = int(self.headers.getheader('content-length')) - except AttributeError: - length = int(self.headers['content-length']) + length = int(self.headers['content-length']) url_str = self.rfile.read(length).decode('utf-8') postvars = cgi.parse_qs(url_str, keep_blank_values=1) else: |