mercurial/hgweb/hgwebdir_mod.py
changeset 5760 0145f9afb0e7
parent 5603 74f65f44a9aa
child 5779 e9f68860d5ed
equal deleted inserted replaced
5759:027264e720aa 5760:0145f9afb0e7
    73 
    73 
    74         try:
    74         try:
    75             try:
    75             try:
    76 
    76 
    77                 virtual = req.env.get("PATH_INFO", "").strip('/')
    77                 virtual = req.env.get("PATH_INFO", "").strip('/')
    78                 
    78 
    79                 # a static file
    79                 # a static file
    80                 if virtual.startswith('static/') or 'static' in req.form:
    80                 if virtual.startswith('static/') or 'static' in req.form:
    81                     static = os.path.join(templater.templatepath(), 'static')
    81                     static = os.path.join(templater.templatepath(), 'static')
    82                     if virtual.startswith('static/'):
    82                     if virtual.startswith('static/'):
    83                         fname = virtual[7:]
    83                         fname = virtual[7:]
   120                     virtual = virtual[:up]
   120                     virtual = virtual[:up]
   121 
   121 
   122                 # prefixes not found
   122                 # prefixes not found
   123                 tmpl = self.templater(req)
   123                 tmpl = self.templater(req)
   124                 req.respond(404, tmpl("notfound", repo=virtual))
   124                 req.respond(404, tmpl("notfound", repo=virtual))
   125                 
   125 
   126             except ErrorResponse, err:
   126             except ErrorResponse, err:
   127                 tmpl = self.templater(req)
   127                 tmpl = self.templater(req)
   128                 req.respond(err.code, tmpl('error', error=err.message or ''))
   128                 req.respond(err.code, tmpl('error', error=err.message or ''))
   129         finally:
   129         finally:
   130             tmpl = None
   130             tmpl = None
   171                 if u.configbool("web", "hidden", untrusted=True):
   171                 if u.configbool("web", "hidden", untrusted=True):
   172                     continue
   172                     continue
   173 
   173 
   174                 parts = [req.env['PATH_INFO'], name]
   174                 parts = [req.env['PATH_INFO'], name]
   175                 if req.env['SCRIPT_NAME']:
   175                 if req.env['SCRIPT_NAME']:
   176                 	parts.insert(0, req.env['SCRIPT_NAME'])
   176                     parts.insert(0, req.env['SCRIPT_NAME'])
   177                 url = ('/'.join(parts).replace("//", "/")) + '/'
   177                 url = ('/'.join(parts).replace("//", "/")) + '/'
   178 
   178 
   179                 # update time with local timezone
   179                 # update time with local timezone
   180                 try:
   180                 try:
   181                     d = (get_mtime(path), util.makedate()[1])
   181                     d = (get_mtime(path), util.makedate()[1])