changeset 34719:6e1b05692b2c

hgweb: detect Python 3-era libraries and use modern attribute names Differential Revision: https://phab.mercurial-scm.org/D1084
author Augie Fackler <augie@google.com>
date Thu, 05 Oct 2017 14:53:52 -0400
parents 01206460897a
children 60e7da55e5e6
files mercurial/hgweb/server.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: