mercurial/hgweb/hgwebdir_mod.py
changeset 36902 e473a032f38a
parent 36901 006165d4d7e2
child 36903 803e0fc0cc9a
equal deleted inserted replaced
36901:006165d4d7e2 36902:e473a032f38a
     7 # GNU General Public License version 2 or any later version.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 from __future__ import absolute_import
     9 from __future__ import absolute_import
    10 
    10 
    11 import os
    11 import os
    12 import re
       
    13 import time
    12 import time
    14 
    13 
    15 from ..i18n import _
    14 from ..i18n import _
    16 
    15 
    17 from .common import (
    16 from .common import (
   159                     r = hg.repository(ui, path)
   158                     r = hg.repository(ui, path)
   160                     directory = False
   159                     directory = False
   161                 except (IOError, error.RepoError):
   160                 except (IOError, error.RepoError):
   162                     pass
   161                     pass
   163 
   162 
   164         parts = [name]
   163         parts = [
   165         parts.insert(0, '/' + subdir.rstrip('/'))
   164             wsgireq.req.apppath.strip('/'),
   166         if wsgireq.env['SCRIPT_NAME']:
   165             subdir.strip('/'),
   167             parts.insert(0, wsgireq.env['SCRIPT_NAME'])
   166             name.strip('/'),
   168         url = re.sub(r'/+', '/', '/'.join(parts) + '/')
   167         ]
       
   168         url = '/' + '/'.join(p for p in parts if p) + '/'
   169 
   169 
   170         # show either a directory entry or a repository
   170         # show either a directory entry or a repository
   171         if directory:
   171         if directory:
   172             # get the directory's time information
   172             # get the directory's time information
   173             try:
   173             try: