From 1d3ad68adae42f05ddd68c1b5183a8db5f2be338 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 25 Oct 2022 09:20:15 +0300 Subject: Add support for extra optional fields --- build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'build.py') diff --git a/build.py b/build.py index f6cba01..8649c73 100644 --- a/build.py +++ b/build.py @@ -11,7 +11,7 @@ NAMES_DIR = ROOT_PATH / "names" BUILD_DIR = ROOT_PATH / "build" STATIC_DIR = ROOT_PATH / "static" -REQUIRED_FIELDS = set(["domain", "name", "email"]) +REQUIRED_FIELDS = set(["domain", "name"]) TEMPLATES = ["index.html"] @@ -29,6 +29,7 @@ for name in listdir(NAMES_DIR): missing_fields = REQUIRED_FIELDS - set(fields.keys()) if missing_fields: raise Exception(f"Missing required fields {missing_fields} in {name}") + names.append(fields) # render templates @@ -40,4 +41,4 @@ for template in TEMPLATES: t = env.get_template(template) index = t.render(names=names) with open(BUILD_DIR / "index.html", "w") as f: - f.write(index) \ No newline at end of file + f.write(index) -- cgit v1.3.1