Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 34515:8afc25e7effc
hgweb: extract function for loading style from request context
Also make it work on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D970
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 05 Oct 2017 14:29:13 -0400 |
parents | a57c938e7ac8 |
children | b50c036494dc |
comparison
equal
deleted
inserted
replaced
34514:528b21b853aa | 34515:8afc25e7effc |
---|---|
501 url = req.env.get('SCRIPT_NAME', '') | 501 url = req.env.get('SCRIPT_NAME', '') |
502 if not url.endswith('/'): | 502 if not url.endswith('/'): |
503 url += '/' | 503 url += '/' |
504 | 504 |
505 vars = {} | 505 vars = {} |
506 styles = ( | 506 styles, (style, mapfile) = hgweb_mod.getstyle(req, config, |
507 req.form.get('style', [None])[0], | 507 self.templatepath) |
508 config('web', 'style'), | |
509 'paper' | |
510 ) | |
511 style, mapfile = templater.stylemap(styles, self.templatepath) | |
512 if style == styles[0]: | 508 if style == styles[0]: |
513 vars['style'] = style | 509 vars['style'] = style |
514 | 510 |
515 start = url[-1] == '?' and '&' or '?' | 511 start = url[-1] == '?' and '&' or '?' |
516 sessionvars = webutil.sessionvars(vars, start) | 512 sessionvars = webutil.sessionvars(vars, start) |