mercurial/hgweb/webcommands.py
changeset 7966 aa983c3d94a9
parent 7876 53c72ba36c2b
child 8209 a1a5a57efe90
equal deleted inserted replaced
7965:8503adbd9d49 7966:aa983c3d94a9
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 import os, mimetypes, re, cgi, copy
     8 import os, mimetypes, re, cgi, copy
     9 import webutil
     9 import webutil
    10 from mercurial import error, archival, templatefilters
    10 from mercurial import error, archival, templater, templatefilters
    11 from mercurial.node import short, hex
    11 from mercurial.node import short, hex
    12 from mercurial.util import binary
    12 from mercurial.util import binary
    13 from common import paritygen, staticfile, get_contact, ErrorResponse
    13 from common import paritygen, staticfile, get_contact, ErrorResponse
    14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
    14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
    15 from mercurial import graphmod, util
    15 from mercurial import graphmod, util
   608     fname = req.form['file'][0]
   608     fname = req.form['file'][0]
   609     # a repo owner may set web.static in .hg/hgrc to get any file
   609     # a repo owner may set web.static in .hg/hgrc to get any file
   610     # readable by the user running the CGI script
   610     # readable by the user running the CGI script
   611     static = web.config("web", "static", None, untrusted=False)
   611     static = web.config("web", "static", None, untrusted=False)
   612     if not static:
   612     if not static:
   613         tp = web.templatepath
   613         tp = web.templatepath or templater.templatepath()
   614         if isinstance(tp, str):
   614         if isinstance(tp, str):
   615             tp = [tp]
   615             tp = [tp]
   616         static = [os.path.join(p, 'static') for p in tp]
   616         static = [os.path.join(p, 'static') for p in tp]
   617     return [staticfile(static, fname, req)]
   617     return [staticfile(static, fname, req)]
   618 
   618