Show More
@@ -30,6 +30,7 from .. import ( | |||||
30 | hg, |
|
30 | hg, | |
31 | hook, |
|
31 | hook, | |
32 | profiling, |
|
32 | profiling, | |
|
33 | pycompat, | |||
33 | repoview, |
|
34 | repoview, | |
34 | templatefilters, |
|
35 | templatefilters, | |
35 | templater, |
|
36 | templater, | |
@@ -60,6 +61,17 archivespecs = util.sortdict(( | |||||
60 | ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), |
|
61 | ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), | |
61 | )) |
|
62 | )) | |
62 |
|
63 | |||
|
64 | def getstyle(req, configfn, templatepath): | |||
|
65 | fromreq = req.form.get('style', [None])[0] | |||
|
66 | if fromreq is not None: | |||
|
67 | fromreq = pycompat.sysbytes(fromreq) | |||
|
68 | styles = ( | |||
|
69 | fromreq, | |||
|
70 | configfn('web', 'style'), | |||
|
71 | 'paper', | |||
|
72 | ) | |||
|
73 | return styles, templater.stylemap(styles, templatepath) | |||
|
74 | ||||
63 | def makebreadcrumb(url, prefix=''): |
|
75 | def makebreadcrumb(url, prefix=''): | |
64 | '''Return a 'URL breadcrumb' list |
|
76 | '''Return a 'URL breadcrumb' list | |
65 |
|
77 | |||
@@ -170,12 +182,8 class requestcontext(object): | |||||
170 | # figure out which style to use |
|
182 | # figure out which style to use | |
171 |
|
183 | |||
172 | vars = {} |
|
184 | vars = {} | |
173 | styles = ( |
|
185 | styles, (style, mapfile) = getstyle(req, self.config, | |
174 | req.form.get('style', [None])[0], |
|
186 | self.templatepath) | |
175 | self.config('web', 'style'), |
|
|||
176 | 'paper', |
|
|||
177 | ) |
|
|||
178 | style, mapfile = templater.stylemap(styles, self.templatepath) |
|
|||
179 | if style == styles[0]: |
|
187 | if style == styles[0]: | |
180 | vars['style'] = style |
|
188 | vars['style'] = style | |
181 |
|
189 |
@@ -503,12 +503,8 class hgwebdir(object): | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now