def get(self, record, field): """ Return the value of ``field`` for ``record``. """ key = record.env.cache_key(field) try: value = self._data[key][field][record._ids[0]] except KeyError: raise CacheMiss(record, field) return value.get() if isinstance(value, SpecialValue) else value
def get(self, record, field, default=NOTHING): """ Return the value of ``field`` for ``record``. """ try: value = self._data[field][record._ids[0]] if field.depends_context: value = value[record.env.cache_key(field)] return value except KeyError: if default is NOTHING: raise CacheMiss(record, field) return default