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