Show More
@@ -53,9 +53,8 b' archivespecs = util.sortdict((' | |||
|
53 | 53 | )) |
|
54 | 54 | |
|
55 | 55 | def getstyle(req, configfn, templatepath): |
|
56 | fromreq = req.form.get('style', [None])[0] | |
|
57 | 56 | styles = ( |
|
58 | fromreq, | |
|
57 | req.qsparams.get('style', None), | |
|
59 | 58 | configfn('web', 'style'), |
|
60 | 59 | 'paper', |
|
61 | 60 | ) |
@@ -160,7 +159,7 b' class requestcontext(object):' | |||
|
160 | 159 | # figure out which style to use |
|
161 | 160 | |
|
162 | 161 | vars = {} |
|
163 | styles, (style, mapfile) = getstyle(wsgireq, self.config, | |
|
162 | styles, (style, mapfile) = getstyle(wsgireq.req, self.config, | |
|
164 | 163 | self.templatepath) |
|
165 | 164 | if style == styles[0]: |
|
166 | 165 | vars['style'] = style |
@@ -337,7 +336,7 b' class hgweb(object):' | |||
|
337 | 336 | cmd = args.pop(0) |
|
338 | 337 | style = cmd.rfind('-') |
|
339 | 338 | if style != -1: |
|
340 |
|
|
|
339 | req.qsparams['style'] = cmd[:style] | |
|
341 | 340 | cmd = cmd[style + 1:] |
|
342 | 341 | |
|
343 | 342 | # avoid accepting e.g. style parameter as command |
@@ -355,7 +354,7 b' class hgweb(object):' | |||
|
355 | 354 | |
|
356 | 355 | ua = req.headers.get('User-Agent', '') |
|
357 | 356 | if cmd == 'rev' and 'mercurial' in ua: |
|
358 |
|
|
|
357 | req.qsparams['style'] = 'raw' | |
|
359 | 358 | |
|
360 | 359 | if cmd == 'archive': |
|
361 | 360 | fn = wsgireq.form['node'][0] |
@@ -389,7 +388,7 b' class hgweb(object):' | |||
|
389 | 388 | if cmd not in webcommands.__all__: |
|
390 | 389 | msg = 'no such method: %s' % cmd |
|
391 | 390 | raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
|
392 |
elif cmd == 'file' and |
|
|
391 | elif cmd == 'file' and req.qsparams.get('style') == 'raw': | |
|
393 | 392 | rctx.ctype = ctype |
|
394 | 393 | content = webcommands.rawfile(rctx, wsgireq, tmpl) |
|
395 | 394 | else: |
@@ -510,7 +510,7 b' class hgwebdir(object):' | |||
|
510 | 510 | url += '/' |
|
511 | 511 | |
|
512 | 512 | vars = {} |
|
513 | styles, (style, mapfile) = hgweb_mod.getstyle(wsgireq, config, | |
|
513 | styles, (style, mapfile) = hgweb_mod.getstyle(wsgireq.req, config, | |
|
514 | 514 | self.templatepath) |
|
515 | 515 | if style == styles[0]: |
|
516 | 516 | vars['style'] = style |
@@ -762,8 +762,8 b' def filediff(web, req, tmpl):' | |||
|
762 | 762 | basectx = ctx.p1() |
|
763 | 763 | |
|
764 | 764 | style = web.config('web', 'style') |
|
765 |
if 'style' in req. |
|
|
766 |
style = req. |
|
|
765 | if 'style' in req.req.qsparams: | |
|
766 | style = req.req.qsparams['style'] | |
|
767 | 767 | |
|
768 | 768 | diffs = webutil.diffs(web, tmpl, ctx, basectx, [path], style) |
|
769 | 769 | if fctx is not None: |
@@ -1011,8 +1011,8 b' def filelog(web, req, tmpl):' | |||
|
1011 | 1011 | entries = [] |
|
1012 | 1012 | |
|
1013 | 1013 | diffstyle = web.config('web', 'style') |
|
1014 |
if 'style' in req. |
|
|
1015 |
diffstyle = req. |
|
|
1014 | if 'style' in req.req.qsparams: | |
|
1015 | diffstyle = req.req.qsparams['style'] | |
|
1016 | 1016 | |
|
1017 | 1017 | def diff(fctx, linerange=None): |
|
1018 | 1018 | ctx = fctx.changectx() |
@@ -438,8 +438,8 b' def changesetentry(web, req, tmpl, ctx):' | |||
|
438 | 438 | basectx = ctx.p1() |
|
439 | 439 | |
|
440 | 440 | style = web.config('web', 'style') |
|
441 |
if 'style' in req. |
|
|
442 |
style = req. |
|
|
441 | if 'style' in req.req.qsparams: | |
|
442 | style = req.req.qsparams['style'] | |
|
443 | 443 | |
|
444 | 444 | diff = diffs(web, tmpl, ctx, basectx, None, style) |
|
445 | 445 |
General Comments 0
You need to be logged in to leave comments.
Login now