equal
deleted
inserted
replaced
39 |
39 |
40 @abc.abstractmethod |
40 @abc.abstractmethod |
41 def getmember(self, context, mapping, key): |
41 def getmember(self, context, mapping, key): |
42 """Return a member item for the specified key |
42 """Return a member item for the specified key |
43 |
43 |
|
44 The key argument may be a wrapped object. |
44 A returned object may be either a wrapped object or a pure value |
45 A returned object may be either a wrapped object or a pure value |
45 depending on the self type. |
46 depending on the self type. |
46 """ |
47 """ |
47 |
48 |
48 @abc.abstractmethod |
49 @abc.abstractmethod |
145 |
146 |
146 def getmember(self, context, mapping, key): |
147 def getmember(self, context, mapping, key): |
147 # TODO: maybe split hybrid list/dict types? |
148 # TODO: maybe split hybrid list/dict types? |
148 if not util.safehasattr(self._values, 'get'): |
149 if not util.safehasattr(self._values, 'get'): |
149 raise error.ParseError(_('not a dictionary')) |
150 raise error.ParseError(_('not a dictionary')) |
|
151 key = unwrapastype(context, mapping, key, self.keytype) |
150 return self._wrapvalue(key, self._values.get(key)) |
152 return self._wrapvalue(key, self._values.get(key)) |
151 |
153 |
152 def _wrapvalue(self, key, val): |
154 def _wrapvalue(self, key, val): |
153 if val is None: |
155 if val is None: |
154 return |
156 return |