mercurial/hgweb/hgwebdir_mod.py
changeset 25660 328739ea70c3
parent 25488 89ce95f907bd
child 26072 06320fb11699
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
   217                     req.env['REPO_NAME'] = virtualrepo
   217                     req.env['REPO_NAME'] = virtualrepo
   218                     try:
   218                     try:
   219                         # ensure caller gets private copy of ui
   219                         # ensure caller gets private copy of ui
   220                         repo = hg.repository(self.ui.copy(), real)
   220                         repo = hg.repository(self.ui.copy(), real)
   221                         return hgweb(repo).run_wsgi(req)
   221                         return hgweb(repo).run_wsgi(req)
   222                     except IOError, inst:
   222                     except IOError as inst:
   223                         msg = inst.strerror
   223                         msg = inst.strerror
   224                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   224                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   225                     except error.RepoError, inst:
   225                     except error.RepoError as inst:
   226                         raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
   226                         raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
   227 
   227 
   228                 up = virtualrepo.rfind('/')
   228                 up = virtualrepo.rfind('/')
   229                 if up < 0:
   229                 if up < 0:
   230                     break
   230                     break
   238 
   238 
   239             # prefixes not found
   239             # prefixes not found
   240             req.respond(HTTP_NOT_FOUND, ctype)
   240             req.respond(HTTP_NOT_FOUND, ctype)
   241             return tmpl("notfound", repo=virtual)
   241             return tmpl("notfound", repo=virtual)
   242 
   242 
   243         except ErrorResponse, err:
   243         except ErrorResponse as err:
   244             req.respond(err, ctype)
   244             req.respond(err, ctype)
   245             return tmpl('error', error=err.message or '')
   245             return tmpl('error', error=err.message or '')
   246         finally:
   246         finally:
   247             tmpl = None
   247             tmpl = None
   248 
   248 
   334                     continue
   334                     continue
   335 
   335 
   336                 u = self.ui.copy()
   336                 u = self.ui.copy()
   337                 try:
   337                 try:
   338                     u.readconfig(os.path.join(path, '.hg', 'hgrc'))
   338                     u.readconfig(os.path.join(path, '.hg', 'hgrc'))
   339                 except Exception, e:
   339                 except Exception as e:
   340                     u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
   340                     u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
   341                     continue
   341                     continue
   342                 def get(section, name, default=None):
   342                 def get(section, name, default=None):
   343                     return u.config(section, name, default, untrusted=True)
   343                     return u.config(section, name, default, untrusted=True)
   344 
   344