Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 28212:d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
This is necessary to preserve filename encoding over JSON. Instead, this
patch inserts "|utf8" where non-ascii local-encoding texts can be passed
to "|json".
See also the commit that introduced "utf8" filter.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 27 Dec 2015 17:59:57 +0900 |
parents | 446465888119 |
children | ca0c0ca30c62 |
comparison
equal
deleted
inserted
replaced
28211:446465888119 | 28212:d4419c01532b |
---|---|
1194 lessvars=lessvars, morevars=morevars, downrev=downrev, | 1194 lessvars=lessvars, morevars=morevars, downrev=downrev, |
1195 cols=cols, rows=rows, | 1195 cols=cols, rows=rows, |
1196 canvaswidth=(cols + 1) * bg_height, | 1196 canvaswidth=(cols + 1) * bg_height, |
1197 truecanvasheight=rows * bg_height, | 1197 truecanvasheight=rows * bg_height, |
1198 canvasheight=canvasheight, bg_height=bg_height, | 1198 canvasheight=canvasheight, bg_height=bg_height, |
1199 jsdata=lambda **x: graphdata(True, str), | 1199 # {jsdata} will be passed to |json, so it must be in utf-8 |
1200 jsdata=lambda **x: graphdata(True, encoding.fromlocal), | |
1200 nodes=lambda **x: graphdata(False, str), | 1201 nodes=lambda **x: graphdata(False, str), |
1201 node=ctx.hex(), changenav=changenav) | 1202 node=ctx.hex(), changenav=changenav) |
1202 | 1203 |
1203 def _getdoc(e): | 1204 def _getdoc(e): |
1204 doc = e[0].__doc__ | 1205 doc = e[0].__doc__ |