Show More
@@ -714,6 +714,7 b' class sessionvars(templateutil.wrapped):' | |||
|
714 | 714 | return sessionvars(copy.copy(self._vars), self._start) |
|
715 | 715 | |
|
716 | 716 | def getmember(self, context, mapping, key): |
|
717 | key = templateutil.unwrapvalue(context, mapping, key) | |
|
717 | 718 | return self._vars.get(key) |
|
718 | 719 | |
|
719 | 720 | def itermaps(self, context): |
@@ -262,7 +262,7 b' def get(context, mapping, args):' | |||
|
262 | 262 | raise error.ParseError(_("get() expects two arguments")) |
|
263 | 263 | |
|
264 | 264 | dictarg = evalwrapped(context, mapping, args[0]) |
|
265 |
key = eval |
|
|
265 | key = evalrawexp(context, mapping, args[1]) | |
|
266 | 266 | try: |
|
267 | 267 | return dictarg.getmember(context, mapping, key) |
|
268 | 268 | except error.ParseError as err: |
@@ -41,6 +41,7 b' class wrapped(object):' | |||
|
41 | 41 | def getmember(self, context, mapping, key): |
|
42 | 42 | """Return a member item for the specified key |
|
43 | 43 | |
|
44 | The key argument may be a wrapped object. | |
|
44 | 45 | A returned object may be either a wrapped object or a pure value |
|
45 | 46 | depending on the self type. |
|
46 | 47 | """ |
@@ -147,6 +148,7 b' class hybrid(wrapped):' | |||
|
147 | 148 | # TODO: maybe split hybrid list/dict types? |
|
148 | 149 | if not util.safehasattr(self._values, 'get'): |
|
149 | 150 | raise error.ParseError(_('not a dictionary')) |
|
151 | key = unwrapastype(context, mapping, key, self.keytype) | |
|
150 | 152 | return self._wrapvalue(key, self._values.get(key)) |
|
151 | 153 | |
|
152 | 154 | def _wrapvalue(self, key, val): |
General Comments 0
You need to be logged in to leave comments.
Login now