Mercurial > kallithea
diff pylons_app/controllers/hg.py @ 10:525ed90e4577
major app speedup moved the wsgi creation to app globals, in order to make it run only once.
little config changes.
author | Marcin Kuzminski |
---|---|
date | Sat, 20 Feb 2010 14:30:13 +0100 |
parents | 3092016c6d0c |
children | 5f30a6d558dc |
line wrap: on
line diff
--- a/pylons_app/controllers/hg.py Thu Feb 18 17:38:27 2010 +0100 +++ b/pylons_app/controllers/hg.py Sat Feb 20 14:30:13 2010 +0100 @@ -6,31 +6,18 @@ from mako.template import Template from pprint import pprint import os -#uncomment the following if you want to serve a single repo -#from mercurial.hgweb.hgweb_mod import hgweb -from mercurial.hgweb.hgwebdir_mod import hgwebdir -from mercurial.hgweb.request import wsgiapplication -log = logging.getLogger(__name__) - from mercurial import ui, hg from mercurial.error import RepoError from ConfigParser import ConfigParser -def make_web_app(): - repos = "hgwebdir.config" - hgwebapp = hgwebdir(repos) - return hgwebapp +log = logging.getLogger(__name__) class HgController(BaseController): - #based on - #http://bel-epa.com/hg/ def index(self): - hgapp = wsgiapplication(make_web_app) - return hgapp(request.environ, self.start_response) + return g.hgapp(request.environ, self.start_response) def view(self, *args, **kwargs): - hgapp = wsgiapplication(make_web_app) - return hgapp(request.environ, self.start_response) + return g.hgapp(request.environ, self.start_response) def add_repo(self, new_repo): tmpl = ''' @@ -58,7 +45,6 @@ def _check_repo(self, repo_name): p = os.path.dirname(__file__) config_path = os.path.join(p, '../..', 'hgwebdir.config') - print config_path cp = ConfigParser()