allow recipe parts

This commit is contained in:
Emi Vasilek 2023-11-01 23:23:50 +01:00
parent a4064a941d
commit 7cf5b7ef29

View file

@ -184,6 +184,18 @@ class Recipe:
self.title = ""
def load(self, dct: Dict[str, Any]) -> List[str]:
issues: List[str] = []
if "parts" in dct:
assert_dict(dct, ["title"], [])
assert_type(dct, "title", str)
self.title = dct["title"]
assert_list(dct["parts"])
for partdct in dct["parts"]:
rp = RecipePart()
issues += rp.load(partdct)
self.parts.append(rp)
else:
rp = RecipePart()
issues = rp.load(dct)
self.parts = [rp]