changeset 34807:3caec3c032c8

webutil: use pycompat.bytestr() instead of str() Stops us from choking the templater on Python 3. With this patch applied, much of hgweb works correctly in Python 3. The notable exception is the graph page, which chokes because it gets node IDs as str instead of bytes. Differential Revision: https://phab.mercurial-scm.org/D1135
author Augie Fackler <augie@google.com>
date Mon, 16 Oct 2017 22:44:06 -0400
parents afd7fd950f6e
children e87e62b7fc0b
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Mon Oct 16 22:43:19 2017 -0400
+++ b/mercurial/hgweb/webutil.py	Mon Oct 16 22:44:06 2017 -0400
@@ -30,6 +30,7 @@
     mdiff,
     patch,
     pathutil,
+    pycompat,
     templatefilters,
     ui as uimod,
     util,
@@ -589,7 +590,10 @@
     def __iter__(self):
         separator = self.start
         for key, value in sorted(self.vars.iteritems()):
-            yield {'name': key, 'value': str(value), 'separator': separator}
+            yield {'name': key,
+                   'value': pycompat.bytestr(value),
+                   'separator': separator,
+            }
             separator = '&'
 
 class wsgiui(uimod.ui):