# HG changeset patch # User Dirkjan Ochtman # Date 1268302908 -3600 # Node ID 92209ae8610af22910848fac895b35095cebf269 # Parent 23ab3b05bd66be28f0dc2172c6518259f2acb19a server: externalize application creation diff -r 23ab3b05bd66 -r 92209ae8610a mercurial/hgweb/server.py --- 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: