lazy: add __bool__ = __nonzero__ for py3 compatibility (#36515)

This commit is contained in:
Frédéric Péters 2019-11-13 20:50:30 +01:00
parent 9e1cf8db69
commit 451e8adfe6
1 changed files with 2 additions and 0 deletions

View File

@ -529,6 +529,8 @@ class LazyFieldVar(object):
return bool(self._data.get(self._field.id))
return bool(self.get_value())
__bool__ = __nonzero__
def __contains__(self, value):
if self._field.key == 'items':
return misc.site_encode(value) in self._data.get(self._field.id)