Patchwork [4,of,5,hgweb-thread-isolation] hgweb: add reponame to requestcontext

login
register
mail settings
Submitter Gregory Szorc
Date Sept. 9, 2015, 9:27 p.m.
Message ID <79bb77a04ffe337d2f27.1441834049@gps-mbp.local>
Download mbox | patch
Permalink /patch/10446/
State Accepted
Headers show

Comments

Gregory Szorc - Sept. 9, 2015, 9:27 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1440288264 25200
#      Sat Aug 22 17:04:24 2015 -0700
# Node ID 79bb77a04ffe337d2f279c99ddc698c371dae599
# Parent  41a5871b279b2d1be1008d1f81e6d9d6a7ad2355
hgweb: add reponame to requestcontext

We have to use object.__setattr__ until the app proxy is gone.

Patch

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
@@ -68,8 +68,9 @@  class requestcontext(object):
     """
     def __init__(self, app):
         object.__setattr__(self, 'app', app)
         object.__setattr__(self, 'repo', app.repo)
+        object.__setattr__(self, 'reponame', app.reponame)
 
         object.__setattr__(self, 'archives', ('zip', 'gz', 'bz2'))
 
         object.__setattr__(self, 'maxchanges',
@@ -175,11 +176,12 @@  class requestcontext(object):
         start = req.url[-1] == '?' and '&' or '?'
         sessionvars = webutil.sessionvars(vars, start)
 
         if not self.reponame:
-            self.reponame = (self.config('web', 'name')
-                             or req.env.get('REPO_NAME')
-                             or req.url.strip('/') or self.repo.root)
+            object.__setattr__(self, 'reponame',
+                               (self.config('web', 'name')
+                                or req.env.get('REPO_NAME')
+                                or req.url.strip('/') or self.repo.root))
 
         def websubfilter(text):
             return websub(text, self.websubtable)