diff 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
line wrap: on
line diff
--- a/pylons_app/lib/app_globals.py	Thu Feb 18 17:38:27 2010 +0100
+++ b/pylons_app/lib/app_globals.py	Sat Feb 20 14:30:13 2010 +0100
@@ -1,5 +1,8 @@
 """The application's Globals object"""
-
+#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
 class Globals(object):
 
     """Globals acts as a container for objects available throughout the
@@ -13,3 +16,12 @@
         'app_globals' variable
 
         """
+        #two ways of building the merc app i don't know 
+        #the fastest one but belive the wsgiapp is better
+        #self.hgapp = self.make_web_app()
+        self.hgapp = wsgiapplication(self.make_web_app)
+
+    def make_web_app(self):
+        repos = "hgwebdir.config"
+        hgwebapp = hgwebdir(repos)
+        return hgwebapp