mercurial/hgweb/hgweb_mod.py
changeset 14953 6ee6ecf1ee89
parent 14913 44382887d012
child 14999 f6a737357195
equal deleted inserted replaced
14952:4c523a2af6e7 14953:6ee6ecf1ee89
     5 #
     5 #
     6 # This software may be used and distributed according to the terms of the
     6 # This software may be used and distributed according to the terms of the
     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 import os
     9 import os
    10 from mercurial import ui, hg, hook, error, encoding, templater
    10 from mercurial import ui, hg, hook, error, encoding, templater, util
    11 from common import get_stat, ErrorResponse, permhooks, caching
    11 from common import get_stat, ErrorResponse, permhooks, caching
    12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
    12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
    13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    14 from request import wsgirequest
    14 from request import wsgirequest
    15 import webcommands, protocol, webutil
    15 import webcommands, protocol, webutil
   145             if style != -1:
   145             if style != -1:
   146                 req.form['style'] = [cmd[:style]]
   146                 req.form['style'] = [cmd[:style]]
   147                 cmd = cmd[style + 1:]
   147                 cmd = cmd[style + 1:]
   148 
   148 
   149             # avoid accepting e.g. style parameter as command
   149             # avoid accepting e.g. style parameter as command
   150             if hasattr(webcommands, cmd):
   150             if util.safehasattr(webcommands, cmd):
   151                 req.form['cmd'] = [cmd]
   151                 req.form['cmd'] = [cmd]
   152             else:
   152             else:
   153                 cmd = ''
   153                 cmd = ''
   154 
   154 
   155             if cmd == 'static':
   155             if cmd == 'static':