Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 36989:de117f579431
templater: factor out helper that renders named template as string
This is quite common in non-web templating, and **kwargs expansion is annoying
because of the unicode-ness of Python3.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 16 Mar 2018 21:24:12 +0900 |
parents | 6ff6e1d6b5b8 |
children | c97b936d8bb5 |
comparison
equal
deleted
inserted
replaced
36988:317382151ac3 | 36989:de117f579431 |
---|---|
28 profiling, | 28 profiling, |
29 pycompat, | 29 pycompat, |
30 repoview, | 30 repoview, |
31 templatefilters, | 31 templatefilters, |
32 templater, | 32 templater, |
33 templateutil, | |
34 ui as uimod, | 33 ui as uimod, |
35 util, | 34 util, |
36 wireprotoserver, | 35 wireprotoserver, |
37 ) | 36 ) |
38 | 37 |
376 | 375 |
377 # process the web interface request | 376 # process the web interface request |
378 | 377 |
379 try: | 378 try: |
380 rctx.tmpl = rctx.templater(req) | 379 rctx.tmpl = rctx.templater(req) |
381 ctype = rctx.tmpl('mimetype', encoding=encoding.encoding) | 380 ctype = rctx.tmpl.render('mimetype', |
382 ctype = templateutil.stringify(ctype) | 381 {'encoding': encoding.encoding}) |
383 | 382 |
384 # check read permissions non-static content | 383 # check read permissions non-static content |
385 if cmd != 'static': | 384 if cmd != 'static': |
386 self.check_perm(rctx, req, None) | 385 self.check_perm(rctx, req, None) |
387 | 386 |