allow recipe parts
This commit is contained in:
parent
a4064a941d
commit
7cf5b7ef29
1 changed files with 16 additions and 4 deletions
12
recipes.py
12
recipes.py
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue