mercurial/hgweb/hgwebdir_mod.py
changeset 34358 8cbcee0b923d
parent 34257 2844c4bd5a39
child 34486 a57c938e7ac8
equal deleted inserted replaced
34357:c41444a39de2 34358:8cbcee0b923d
    32     configitems,
    32     configitems,
    33     encoding,
    33     encoding,
    34     error,
    34     error,
    35     hg,
    35     hg,
    36     profiling,
    36     profiling,
       
    37     pycompat,
    37     scmutil,
    38     scmutil,
    38     templater,
    39     templater,
    39     ui as uimod,
    40     ui as uimod,
    40     util,
    41     util,
    41 )
    42 )
   104         port = u.port
   105         port = u.port
   105     path = u.path or ""
   106     path = u.path or ""
   106     if not path.startswith('/'):
   107     if not path.startswith('/'):
   107         path = '/' + path
   108         path = '/' + path
   108 
   109 
   109     return name, str(port), path
   110     return name, pycompat.bytestr(port), path
   110 
   111 
   111 class hgwebdir(object):
   112 class hgwebdir(object):
   112     """HTTP server for multiple repositories.
   113     """HTTP server for multiple repositories.
   113 
   114 
   114     Given a configuration, different repositories will be served depending
   115     Given a configuration, different repositories will be served depending
   291                         return hgweb_mod.hgweb(repo).run_wsgi(req)
   292                         return hgweb_mod.hgweb(repo).run_wsgi(req)
   292                     except IOError as inst:
   293                     except IOError as inst:
   293                         msg = encoding.strtolocal(inst.strerror)
   294                         msg = encoding.strtolocal(inst.strerror)
   294                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   295                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   295                     except error.RepoError as inst:
   296                     except error.RepoError as inst:
   296                         raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
   297                         raise ErrorResponse(HTTP_SERVER_ERROR, bytes(inst))
   297 
   298 
   298             # browse subdirectories
   299             # browse subdirectories
   299             subdir = virtual + '/'
   300             subdir = virtual + '/'
   300             if [r for r in repos if r.startswith(subdir)]:
   301             if [r for r in repos if r.startswith(subdir)]:
   301                 req.respond(HTTP_OK, ctype)
   302                 req.respond(HTTP_OK, ctype)