Mercurial > public > mercurial-scm > hg
comparison mercurial/templatefuncs.py @ 38240:c2456a7726c1
templater: do dict lookup over a wrapped object
Dict/list lookup operations will be moved to a wrapped interface so that
a returned element can inherit hybrid-ness automatically. wraphybridvalue()
will be inlined.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 21 Mar 2018 01:18:29 +0900 |
parents | ead71b15efd5 |
children | 12b6ee9e88f3 |
comparison
equal
deleted
inserted
replaced
38239:ead71b15efd5 | 38240:c2456a7726c1 |
---|---|
259 attribute on these types.""" | 259 attribute on these types.""" |
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 = evalfuncarg(context, mapping, args[0]) | 264 dictarg = evalwrapped(context, mapping, args[0]) |
265 if not util.safehasattr(dictarg, 'get'): | 265 if not util.safehasattr(dictarg, 'get'): |
266 # i18n: "get" is a keyword | 266 # i18n: "get" is a keyword |
267 raise error.ParseError(_("get() expects a dict as first argument")) | 267 raise error.ParseError(_("get() expects a dict as first argument")) |
268 | 268 |
269 key = evalfuncarg(context, mapping, args[1]) | 269 key = evalfuncarg(context, mapping, args[1]) |