mercurial/hgweb/hgwebdir_mod.py
changeset 34358 8cbcee0b923d
parent 34257 2844c4bd5a39
child 34486 a57c938e7ac8
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Sep 27 18:07:48 2017 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Sep 27 19:04:32 2017 +0900
@@ -34,6 +34,7 @@
     error,
     hg,
     profiling,
+    pycompat,
     scmutil,
     templater,
     ui as uimod,
@@ -106,7 +107,7 @@
     if not path.startswith('/'):
         path = '/' + path
 
-    return name, str(port), path
+    return name, pycompat.bytestr(port), path
 
 class hgwebdir(object):
     """HTTP server for multiple repositories.
@@ -293,7 +294,7 @@
                         msg = encoding.strtolocal(inst.strerror)
                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
                     except error.RepoError as inst:
-                        raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
+                        raise ErrorResponse(HTTP_SERVER_ERROR, bytes(inst))
 
             # browse subdirectories
             subdir = virtual + '/'