fix missing getitem

This commit is contained in:
relikd
2022-04-06 17:55:27 +02:00
parent 831cfa4e9c
commit a694149d04

View File

@@ -114,12 +114,10 @@ class GroupBySource(VirtualSourceObject):
return val[0] if val else None
def __getitem__(self, key: str) -> Any:
# Used for virtual path resolver and |sort(attribute="x") filter
# Used for virtual path resolver
if key in ('_path', '_alt'):
return getattr(self, key[1:])
if hasattr(self, key):
return getattr(self, key)
return None
return self.__missing__(key) # type: ignore[attr-defined]
def __lt__(self, other: 'GroupBySource') -> bool:
# Used for |sort filter ("group" is the provided original string)