Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 26210:7c759f1a056f
hgweb: add reponame to requestcontext
We have to use object.__setattr__ until the app proxy is gone.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 22 Aug 2015 17:04:24 -0700 |
parents | 7917746c9a67 |
children | ea489d94e1dc |
comparison
equal
deleted
inserted
replaced
26209:7917746c9a67 | 26210:7c759f1a056f |
---|---|
67 mutable and race-free state for requests. | 67 mutable and race-free state for requests. |
68 """ | 68 """ |
69 def __init__(self, app): | 69 def __init__(self, app): |
70 object.__setattr__(self, 'app', app) | 70 object.__setattr__(self, 'app', app) |
71 object.__setattr__(self, 'repo', app.repo) | 71 object.__setattr__(self, 'repo', app.repo) |
72 object.__setattr__(self, 'reponame', app.reponame) | |
72 | 73 |
73 object.__setattr__(self, 'archives', ('zip', 'gz', 'bz2')) | 74 object.__setattr__(self, 'archives', ('zip', 'gz', 'bz2')) |
74 | 75 |
75 object.__setattr__(self, 'maxchanges', | 76 object.__setattr__(self, 'maxchanges', |
76 self.configint('web', 'maxchanges', 10)) | 77 self.configint('web', 'maxchanges', 10)) |
174 | 175 |
175 start = req.url[-1] == '?' and '&' or '?' | 176 start = req.url[-1] == '?' and '&' or '?' |
176 sessionvars = webutil.sessionvars(vars, start) | 177 sessionvars = webutil.sessionvars(vars, start) |
177 | 178 |
178 if not self.reponame: | 179 if not self.reponame: |
179 self.reponame = (self.config('web', 'name') | 180 object.__setattr__(self, 'reponame', |
180 or req.env.get('REPO_NAME') | 181 (self.config('web', 'name') |
181 or req.url.strip('/') or self.repo.root) | 182 or req.env.get('REPO_NAME') |
183 or req.url.strip('/') or self.repo.root)) | |
182 | 184 |
183 def websubfilter(text): | 185 def websubfilter(text): |
184 return websub(text, self.websubtable) | 186 return websub(text, self.websubtable) |
185 | 187 |
186 # create the templater | 188 # create the templater |