Mercurial > hg
changeset 10638:92209ae8610a
server: externalize application creation
author | Dirkjan Ochtman <djc.ochtman@kentyde.com> |
---|---|
date | Thu, 11 Mar 2010 11:21:48 +0100 |
parents | 23ab3b05bd66 |
children | a6808629f450 |
files | mercurial/hgweb/server.py |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Tue Mar 09 21:53:16 2010 -0500 +++ b/mercurial/hgweb/server.py Thu Mar 11 11:21:48 2010 +0100 @@ -233,6 +233,14 @@ class _mixin: pass + if webdir_conf: + hgwebobj = hgwebdir(webdir_conf, ui) + elif repo is not None: + hgwebobj = hgweb(hg.repository(repo.ui, repo.root)) + else: + raise error.RepoError(_("There is no Mercurial repository" + " here (.hg not found)")) + class MercurialHTTPServer(object, _mixin, BaseHTTPServer.HTTPServer): # SO_REUSEADDR has broken semantics on windows @@ -244,16 +252,7 @@ self.accesslog = accesslog self.errorlog = errorlog self.daemon_threads = True - def make_handler(): - if webdir_conf: - hgwebobj = hgwebdir(webdir_conf, ui) - elif repo is not None: - hgwebobj = hgweb(hg.repository(repo.ui, repo.root)) - else: - raise error.RepoError(_("There is no Mercurial repository" - " here (.hg not found)")) - return hgwebobj - self.application = make_handler() + self.application = hgwebobj if ssl_cert: try: