mercurial/hgweb/common.py
changeset 7107 125c8fedcbe0
parent 7029 b84d27386285
child 7288 9c399c53469d
equal deleted inserted replaced
7106:4674706b5b95 7107:125c8fedcbe0
    80     2. templatepath/map-style
    80     2. templatepath/map-style
    81     3. templatepath/map
    81     3. templatepath/map
    82     """
    82     """
    83     locations = style and [os.path.join(style, "map"), "map-"+style] or []
    83     locations = style and [os.path.join(style, "map"), "map-"+style] or []
    84     locations.append("map")
    84     locations.append("map")
    85     for location in locations:
    85     if isinstance(templatepath, str):
    86         mapfile = os.path.join(templatepath, location)
    86         templatepath = [templatepath]
    87         if os.path.isfile(mapfile):
    87     for path in templatepath:
    88             return mapfile
    88         for location in locations:
       
    89             mapfile = os.path.join(path, location)
       
    90             if os.path.isfile(mapfile):
       
    91                 return mapfile
    89     raise RuntimeError("No hgweb templates found in %r" % templatepath)
    92     raise RuntimeError("No hgweb templates found in %r" % templatepath)
    90 
    93 
    91 def paritygen(stripecount, offset=0):
    94 def paritygen(stripecount, offset=0):
    92     """count parity of horizontal stripes for easier reading"""
    95     """count parity of horizontal stripes for easier reading"""
    93     if stripecount and offset:
    96     if stripecount and offset: