comparison mercurial/templatefuncs.py @ 38244:688fbb758ba9

templater: resolve type of dict key in getmember() This seems more correct and is consistent with the future wrapped.contains() function, where a key type has to be resolved depending on a container type.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 04 May 2018 12:43:15 +0900
parents 06d11cd90516
children 41ae9b3cbfb9
comparison
equal deleted inserted replaced
38243:06d11cd90516 38244:688fbb758ba9
260 if len(args) != 2: 260 if len(args) != 2:
261 # i18n: "get" is a keyword 261 # i18n: "get" is a keyword
262 raise error.ParseError(_("get() expects two arguments")) 262 raise error.ParseError(_("get() expects two arguments"))
263 263
264 dictarg = evalwrapped(context, mapping, args[0]) 264 dictarg = evalwrapped(context, mapping, args[0])
265 key = evalfuncarg(context, mapping, args[1]) 265 key = evalrawexp(context, mapping, args[1])
266 try: 266 try:
267 return dictarg.getmember(context, mapping, key) 267 return dictarg.getmember(context, mapping, key)
268 except error.ParseError as err: 268 except error.ParseError as err:
269 # i18n: "get" is a keyword 269 # i18n: "get" is a keyword
270 hint = _("get() expects a dict as first argument") 270 hint = _("get() expects a dict as first argument")