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

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 1:27 p.m.
Message ID <654d7bc59aefc7836e673adae632b2b8@localhost.localdomain>
Download mbox | patch
Permalink /patch/24941/
State Not Applicable
Headers show

Comments

phabricator - Oct. 15, 2017, 1:27 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6e1b05692b2c: hgweb: detect Python 3-era libraries and use modern attribute names (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1084?vs=2764&id=2774

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

AFFECTED FILES
  mercurial/hgweb/server.py

CHANGE DETAILS




To: durin42, #hg-reviewers, yuja
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: