comparison pylons_app/lib/app_globals.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 564e40829f80
children bbaab7501c1a
comparison
equal deleted inserted replaced
9:058f63b6c2ff 10:525ed90e4577
1 """The application's Globals object""" 1 """The application's Globals object"""
2 2 #uncomment the following if you want to serve a single repo
3 #from mercurial.hgweb.hgweb_mod import hgweb
4 from mercurial.hgweb.hgwebdir_mod import hgwebdir
5 from mercurial.hgweb.request import wsgiapplication
3 class Globals(object): 6 class Globals(object):
4 7
5 """Globals acts as a container for objects available throughout the 8 """Globals acts as a container for objects available throughout the
6 life of the application 9 life of the application
7 10
11 """One instance of Globals is created during application 14 """One instance of Globals is created during application
12 initialization and is available during requests via the 15 initialization and is available during requests via the
13 'app_globals' variable 16 'app_globals' variable
14 17
15 """ 18 """
19 #two ways of building the merc app i don't know
20 #the fastest one but belive the wsgiapp is better
21 #self.hgapp = self.make_web_app()
22 self.hgapp = wsgiapplication(self.make_web_app)
23
24 def make_web_app(self):
25 repos = "hgwebdir.config"
26 hgwebapp = hgwebdir(repos)
27 return hgwebapp