comparison mercurial/hgweb/server.py @ 5129:ff461baa9c4e

merge with -stable
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 09 Aug 2007 01:07:11 +0200
parents 06154aff2b1a 86cd6fd61042
children
comparison
equal deleted inserted replaced
5127:1a028bdaddce 5129:ff461baa9c4e
201 def openlog(opt, default): 201 def openlog(opt, default):
202 if opt and opt != '-': 202 if opt and opt != '-':
203 return open(opt, 'w') 203 return open(opt, 'w')
204 return default 204 return default
205 205
206 def create_getconfig(section, *uis): # uis are least significant to most
207 def getconfig(var, default=None):
208 val = default
209 for u in uis:
210 val = u.config(section, var, val)
211 return val
212 def getconfigbool(var, default=None):
213 val = default
214 for u in uis:
215 val = u.configbool(section, var, val)
216 return (getconfig, getconfigbool)
217
218 if repo is None: 206 if repo is None:
219 getconfig, getconfigbool = create_getconfig("web", ui) 207 myui = ui
220 else: 208 else:
221 getconfig, getconfigbool = create_getconfig("web", ui, repo.ui) 209 myui = repo.ui
222 address = getconfig("address", "") 210 address = myui.config("web", "address", "")
223 port = int(getconfig("port", 8000)) 211 port = int(myui.config("web", "port", 8000))
224 use_ipv6 = getconfigbool("ipv6") 212 use_ipv6 = myui.configbool("web", "ipv6")
225 webdir_conf = getconfig("webdir_conf") 213 webdir_conf = myui.config("web", "webdir_conf")
226 ssl_cert = getconfig("certificate") 214 ssl_cert = myui.config("web", "certificate")
227 accesslog = openlog(getconfig("accesslog", "-"), sys.stdout) 215 accesslog = openlog(myui.config("web", "accesslog", "-"), sys.stdout)
228 errorlog = openlog(getconfig("errorlog", "-"), sys.stderr) 216 errorlog = openlog(myui.config("web", "errorlog", "-"), sys.stderr)
229 217
230 if use_threads: 218 if use_threads:
231 try: 219 try:
232 from threading import activeCount 220 from threading import activeCount
233 except ImportError: 221 except ImportError: