hgweb: create websubtable on requestcontext
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 22 Aug 2015 16:39:29 -0700
changeset 26164 e037fd28c8bb
parent 26163 84511b1d9724
child 26165 927c0d84e09f
hgweb: create websubtable on requestcontext
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 16:28:22 2015 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 16:39:29 2015 -0700
@@ -90,6 +90,13 @@
         object.__setattr__(self, 'templatepath',
                            self.config('web', 'templates', untrusted=False))
 
+        # This object is more expensive to build than simple config values.
+        # It is shared across requests. The app will replace the object
+        # if it is updated. Since this is a reference and nothing should
+        # modify the underlying object, it should be constant for the lifetime
+        # of the request.
+        object.__setattr__(self, 'websubtable', app.websubtable)
+
     # Proxy unknown reads and writes to the application instance
     # until everything is moved to us.
     def __getattr__(self, name):