mercurial/hgweb/webcommands.py
changeset 5925 c6274913eba5
parent 5915 d0576d065993
child 5926 15ef6b9c1f2f
equal deleted inserted replaced
5924:b8009718a211 5925:c6274913eba5
     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
     8 import os, mimetypes
     9 from mercurial import revlog, util
     9 from mercurial import revlog, util
    10 from common import staticfile
    10 from common import staticfile, ErrorResponse
    11 
    11 
    12 def log(web, req, tmpl):
    12 def log(web, req, tmpl):
    13     if 'file' in req.form and req.form['file'][0]:
    13     if 'file' in req.form and req.form['file'][0]:
    14         filelog(web, req, tmpl)
    14         filelog(web, req, tmpl)
    15     else:
    15     else:
    98     if (type_ in web.archives and (type_ in allowed or
    98     if (type_ in web.archives and (type_ in allowed or
    99         web.configbool("web", "allow" + type_, False))):
    99         web.configbool("web", "allow" + type_, False))):
   100         web.archive(tmpl, req, req.form['node'][0], type_)
   100         web.archive(tmpl, req, req.form['node'][0], type_)
   101         return
   101         return
   102 
   102 
   103     req.respond(400, tmpl('error',
   103     raise ErrorResponse(400, 'Unsupported archive type: %s' % type_)
   104                            error='Unsupported archive type: %s' % type_))
       
   105 
   104 
   106 def static(web, req, tmpl):
   105 def static(web, req, tmpl):
   107     fname = req.form['file'][0]
   106     fname = req.form['file'][0]
   108     # a repo owner may set web.static in .hg/hgrc to get any file
   107     # a repo owner may set web.static in .hg/hgrc to get any file
   109     # readable by the user running the CGI script
   108     # readable by the user running the CGI script