hgweb: detect Python 3-era libraries and use modern attribute names
Differential Revision: https://phab.mercurial-scm.org/D1084
--- a/mercurial/hgweb/server.py Sat Oct 14 15:53:36 2017 -0400
+++ b/mercurial/hgweb/server.py Thu Oct 05 14:53:52 2017 -0400
@@ -130,7 +130,13 @@
if query:
env[r'QUERY_STRING'] = query
- if True:
+ if pycompat.ispy3:
+ if self.headers.get_content_type() is None:
+ env[r'CONTENT_TYPE'] = self.headers.get_default_type()
+ else:
+ env[r'CONTENT_TYPE'] = self.headers.get_content_type()
+ length = self.headers.get('content-length')
+ else:
if self.headers.typeheader is None:
env[r'CONTENT_TYPE'] = self.headers.type
else: