Patchwork D1084: hgweb: detect Python 3-era libraries and use modern attribute names

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 4:57 a.m.
Message ID <differential-rev-PHID-DREV-bhecrqjmsxnm6ecwqcvj-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24931/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2017, 4:57 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1084

AFFECTED FILES
  mercurial/hgweb/server.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -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: