Skip to content

Commit ec981b0

Browse files
authored
Row __contains__ allowing membership checking of aliased fields in _extra (#744)
Sorry this took long time. :-)
1 parent 8bed9b7 commit ec981b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pydal/objects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ def __getitem__(self, k):
186186

187187
raise KeyError(key)
188188

189+
def __contains__(self, k):
190+
key = str(k)
191+
192+
_extra = BasicStorage.get(self, "_extra", None)
193+
return (_extra is not None and k in _extra) or BasicStorage.__contains__(self, key)
194+
189195
def __repr__(self):
190196
return "<Row %s>" % self.as_dict(custom_types=[LazySet])
191197

0 commit comments

Comments
 (0)