[PATCH 5 of 5 hgweb-thread-isolation] hgweb: create websubtable on requestcontext

Gregory Szorc gregory.szorc at gmail.com
Wed Sep 2 19:24:49 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1440286769 25200
#      Sat Aug 22 16:39:29 2015 -0700
# Node ID 3a75fe3376608704d4056dc3b93d0a200efe97b1
# Parent  0be65f46507519c504b61483b3ce169b04ae60b5
hgweb: create websubtable on requestcontext

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -89,8 +89,15 @@ class requestcontext(object):
         # by the user running the CGI script
         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):
         return getattr(self.app, name)


More information about the Mercurial-devel mailing list