Show More
@@ -141,7 +141,7 class requestcontext(object): | |||||
141 | if typ in allowed or self.configbool('web', 'allow%s' % typ): |
|
141 | if typ in allowed or self.configbool('web', 'allow%s' % typ): | |
142 | yield {'type': typ, 'extension': spec[2], 'node': nodeid} |
|
142 | yield {'type': typ, 'extension': spec[2], 'node': nodeid} | |
143 |
|
143 | |||
144 |
def templater(self, |
|
144 | def templater(self, req): | |
145 | # determine scheme, port and server name |
|
145 | # determine scheme, port and server name | |
146 | # this is needed to create absolute urls |
|
146 | # this is needed to create absolute urls | |
147 | logourl = self.config('web', 'logourl') |
|
147 | logourl = self.config('web', 'logourl') | |
@@ -159,7 +159,7 class requestcontext(object): | |||||
159 | # figure out which style to use |
|
159 | # figure out which style to use | |
160 |
|
160 | |||
161 | vars = {} |
|
161 | vars = {} | |
162 |
styles, (style, mapfile) = getstyle( |
|
162 | styles, (style, mapfile) = getstyle(req, self.config, | |
163 | self.templatepath) |
|
163 | self.templatepath) | |
164 | if style == styles[0]: |
|
164 | if style == styles[0]: | |
165 | vars['style'] = style |
|
165 | vars['style'] = style | |
@@ -168,8 +168,9 class requestcontext(object): | |||||
168 |
|
168 | |||
169 | if not self.reponame: |
|
169 | if not self.reponame: | |
170 | self.reponame = (self.config('web', 'name', '') |
|
170 | self.reponame = (self.config('web', 'name', '') | |
171 |
or |
|
171 | or req.reponame | |
172 |
or req.apppath |
|
172 | or req.apppath | |
|
173 | or self.repo.root) | |||
173 |
|
174 | |||
174 | def websubfilter(text): |
|
175 | def websubfilter(text): | |
175 | return templatefilters.websub(text, self.websubtable) |
|
176 | return templatefilters.websub(text, self.websubtable) | |
@@ -372,7 +373,7 class hgweb(object): | |||||
372 | # process the web interface request |
|
373 | # process the web interface request | |
373 |
|
374 | |||
374 | try: |
|
375 | try: | |
375 |
tmpl = rctx.templater( |
|
376 | tmpl = rctx.templater(req) | |
376 | ctype = tmpl('mimetype', encoding=encoding.encoding) |
|
377 | ctype = tmpl('mimetype', encoding=encoding.encoding) | |
377 | ctype = templater.stringify(ctype) |
|
378 | ctype = templater.stringify(ctype) | |
378 |
|
379 |
@@ -144,6 +144,8 class parsedrequest(object): | |||||
144 | # Whether there is a path component to this request. This can be true |
|
144 | # Whether there is a path component to this request. This can be true | |
145 | # when ``dispatchpath`` is empty due to REPO_NAME muckery. |
|
145 | # when ``dispatchpath`` is empty due to REPO_NAME muckery. | |
146 | havepathinfo = attr.ib() |
|
146 | havepathinfo = attr.ib() | |
|
147 | # The name of the repository being accessed. | |||
|
148 | reponame = attr.ib() | |||
147 | # Raw query string (part after "?" in URL). |
|
149 | # Raw query string (part after "?" in URL). | |
148 | querystring = attr.ib() |
|
150 | querystring = attr.ib() | |
149 | # multidict of query string parameters. |
|
151 | # multidict of query string parameters. | |
@@ -282,6 +284,7 def parserequestfromenv(env, bodyfh): | |||||
282 | apppath=apppath, |
|
284 | apppath=apppath, | |
283 | dispatchparts=dispatchparts, dispatchpath=dispatchpath, |
|
285 | dispatchparts=dispatchparts, dispatchpath=dispatchpath, | |
284 | havepathinfo='PATH_INFO' in env, |
|
286 | havepathinfo='PATH_INFO' in env, | |
|
287 | reponame=env.get('REPO_NAME'), | |||
285 | querystring=querystring, |
|
288 | querystring=querystring, | |
286 | qsparams=qsparams, |
|
289 | qsparams=qsparams, | |
287 | headers=headers, |
|
290 | headers=headers, |
General Comments 0
You need to be logged in to leave comments.
Login now