weegee: fix Base.find() to work with items that can follow different metas

This commit is contained in:
Shiz 2021-12-14 19:54:23 +01:00
parent 597c700ff7
commit e32a27bc53
1 changed files with 7 additions and 1 deletions

View File

@ -62,7 +62,13 @@ class WeegeeBase:
@classmethod
def find(cls: TypeOf[B], context: WeegeeContext, pattern: str) -> list[B]:
return [cls(context, Item.load(context.instance, name)) for name in Item.filter(context.instance, cls.get_name(pattern))]
objects = []
meta = cls.get_meta(context)
for name in Item.filter(context.instance, cls.get_name(pattern)):
item = Item.load(context.instance, name)
if item.is_complete(meta):
objects.append(cls(context, item, meta))
return objects
@classmethod
def load(cls: TypeOf[B], context: WeegeeContext, name: str, path: O[str] = None, restore: bool = False) -> B: