pull/76/head
meisnate12 4 years ago
parent 861df0a97e
commit 92d5e29a91

@ -54,10 +54,7 @@ class CollectionBuilder:
if template["default"]:
if isinstance(template["default"], dict):
for dv in template["default"]:
if template["default"][dv]:
default[dv] = template["default"][dv]
else:
raise Failed(f"Collection Error: template default sub-attribute {dv} is blank")
else:
raise Failed("Collection Error: template sub-attribute default is not a dictionary")
else:
@ -75,12 +72,15 @@ class CollectionBuilder:
txt = txt.replace("<<collection_name>>", str(self.name))
for dm in default:
if f"<<{dm}>>" in txt:
if default[dm] is None:
raise Failed(f"template default {dm} is blank")
txt = txt.replace(f"<<{dm}>>", str(default[dm]))
if txt in ["true", "True"]: return True
elif txt in ["false", "False"]: return False
else:
try: return int(txt)
except ValueError: return txt
try:
if isinstance(template[m], dict):
attr = {}
for sm in template[m]:
@ -103,6 +103,8 @@ class CollectionBuilder:
attr.append(replace_txt(li))
else:
attr = replace_txt(template[m])
except Failed:
continue
self.data[m] = attr
else:
raise Failed(f"Collection Error: template attribute {m} is blank")

Loading…
Cancel
Save