mercurial/hgweb/server.py
changeset 5083 f94dbc6c7eaf
parent 4835 9858477ed74c
child 5086 86cd6fd61042
child 5148 06154aff2b1a
equal deleted inserted replaced
5082:dc2e512cb89a 5083:f94dbc6c7eaf
   170     def openlog(opt, default):
   170     def openlog(opt, default):
   171         if opt and opt != '-':
   171         if opt and opt != '-':
   172             return open(opt, 'w')
   172             return open(opt, 'w')
   173         return default
   173         return default
   174 
   174 
   175     address = repo.ui.config("web", "address", "")
   175     def create_getconfig(section, *uis): # uis are least significant to most
   176     port = int(repo.ui.config("web", "port", 8000))
   176         def getconfig(var, default=None):
   177     use_ipv6 = repo.ui.configbool("web", "ipv6")
   177             val = default
   178     webdir_conf = repo.ui.config("web", "webdir_conf")
   178             for u in uis:
   179     accesslog = openlog(repo.ui.config("web", "accesslog", "-"), sys.stdout)
   179                 val = u.config(section, var, val)
   180     errorlog = openlog(repo.ui.config("web", "errorlog", "-"), sys.stderr)
   180             return val
       
   181         def getconfigbool(var, default=None):
       
   182             val = default
       
   183             for u in uis:
       
   184                 val = u.configbool(section, var, val)
       
   185         return (getconfig, getconfigbool)
       
   186 
       
   187     if repo is None:
       
   188         getconfig, getconfigbool = create_getconfig("web", ui)
       
   189     else:
       
   190         getconfig, getconfigbool = create_getconfig("web", ui, repo.ui)
       
   191     address = getconfig("address", "")
       
   192     port = int(getconfig("port", 8000))
       
   193     use_ipv6 = getconfigbool("ipv6")
       
   194     webdir_conf = getconfig("webdir_conf")
       
   195     accesslog = openlog(getconfig("accesslog", "-"), sys.stdout)
       
   196     errorlog = openlog(getconfig("errorlog", "-"), sys.stderr)
   181 
   197 
   182     if use_threads:
   198     if use_threads:
   183         try:
   199         try:
   184             from threading import activeCount
   200             from threading import activeCount
   185         except ImportError:
   201         except ImportError: