Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/server.py @ 5086:86cd6fd61042
unobfuscate part of f94dbc6c7eaf
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 09 Aug 2007 01:04:27 +0200 |
parents | f94dbc6c7eaf |
children | ff461baa9c4e |
comparison
equal
deleted
inserted
replaced
5085:dcfd75502b82 | 5086:86cd6fd61042 |
---|---|
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 def create_getconfig(section, *uis): # uis are least significant to most | |
176 def getconfig(var, default=None): | |
177 val = default | |
178 for u in uis: | |
179 val = u.config(section, var, val) | |
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: | 175 if repo is None: |
188 getconfig, getconfigbool = create_getconfig("web", ui) | 176 myui = ui |
189 else: | 177 else: |
190 getconfig, getconfigbool = create_getconfig("web", ui, repo.ui) | 178 myui = repo.ui |
191 address = getconfig("address", "") | 179 address = myui.config("web", "address", "") |
192 port = int(getconfig("port", 8000)) | 180 port = int(myui.config("web", "port", 8000)) |
193 use_ipv6 = getconfigbool("ipv6") | 181 use_ipv6 = myui.configbool("web", "ipv6") |
194 webdir_conf = getconfig("webdir_conf") | 182 webdir_conf = myui.config("web", "webdir_conf") |
195 accesslog = openlog(getconfig("accesslog", "-"), sys.stdout) | 183 accesslog = openlog(myui.config("web", "accesslog", "-"), sys.stdout) |
196 errorlog = openlog(getconfig("errorlog", "-"), sys.stderr) | 184 errorlog = openlog(myui.config("web", "errorlog", "-"), sys.stderr) |
197 | 185 |
198 if use_threads: | 186 if use_threads: |
199 try: | 187 try: |
200 from threading import activeCount | 188 from threading import activeCount |
201 except ImportError: | 189 except ImportError: |