comparison mercurial/hgweb/hgweb_mod.py @ 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 7187f6e923d5
comparison
equal deleted inserted replaced
26163:84511b1d9724 26164:e037fd28c8bb
87 # we use untrusted=False to prevent a repo owner from using 87 # we use untrusted=False to prevent a repo owner from using
88 # web.templates in .hg/hgrc to get access to any file readable 88 # web.templates in .hg/hgrc to get access to any file readable
89 # by the user running the CGI script 89 # by the user running the CGI script
90 object.__setattr__(self, 'templatepath', 90 object.__setattr__(self, 'templatepath',
91 self.config('web', 'templates', untrusted=False)) 91 self.config('web', 'templates', untrusted=False))
92
93 # This object is more expensive to build than simple config values.
94 # It is shared across requests. The app will replace the object
95 # if it is updated. Since this is a reference and nothing should
96 # modify the underlying object, it should be constant for the lifetime
97 # of the request.
98 object.__setattr__(self, 'websubtable', app.websubtable)
92 99
93 # Proxy unknown reads and writes to the application instance 100 # Proxy unknown reads and writes to the application instance
94 # until everything is moved to us. 101 # until everything is moved to us.
95 def __getattr__(self, name): 102 def __getattr__(self, name):
96 return getattr(self.app, name) 103 return getattr(self.app, name)