changeset 26164:e037fd28c8bb

hgweb: create websubtable on requestcontext
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 22 Aug 2015 16:39:29 -0700
parents 84511b1d9724
children 927c0d84e09f
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):