Commit a8c8da88 authored by scmalte's avatar scmalte
Browse files

aggr.py: added more helpful exception when cluster file template missing

parent d4ce0139
...@@ -9,12 +9,14 @@ DEFAULT_CLUSTER_FILES_DIR="_clusters" ...@@ -9,12 +9,14 @@ DEFAULT_CLUSTER_FILES_DIR="_clusters"
DEFAULT_CLUSTERS_MATCHES_CSV_FILE="clusters-matches.csv" DEFAULT_CLUSTERS_MATCHES_CSV_FILE="clusters-matches.csv"
DEFAULT_CLUSTER_STUDENTS_CSV_FILE_PATTERN="cluster-students-{}.csv" DEFAULT_CLUSTER_STUDENTS_CSV_FILE_PATTERN="cluster-students-{}.csv"
DEFAULT_CX_COURSE_STUDENTS_CSV_FILE="cx_students.csv" DEFAULT_CX_COURSE_STUDENTS_CSV_FILE="cx_students.csv"
DEFAULT_JINJA_CLUSTER_TEMPLATE_FILE="./_static/clusters.html.jinja"
def main( def main(
cluster_files_dir=DEFAULT_CLUSTER_FILES_DIR, cluster_files_dir=DEFAULT_CLUSTER_FILES_DIR,
clusters_matches_csv_file=DEFAULT_CLUSTERS_MATCHES_CSV_FILE, clusters_matches_csv_file=DEFAULT_CLUSTERS_MATCHES_CSV_FILE,
cluster_students_csv_file_pattern=DEFAULT_CLUSTER_STUDENTS_CSV_FILE_PATTERN, cluster_students_csv_file_pattern=DEFAULT_CLUSTER_STUDENTS_CSV_FILE_PATTERN,
cx_course_students_csv_file=DEFAULT_CX_COURSE_STUDENTS_CSV_FILE): cx_course_students_csv_file=DEFAULT_CX_COURSE_STUDENTS_CSV_FILE,
jinja_cluster_template_file=DEFAULT_JINJA_CLUSTER_TEMPLATE_FILE):
logutils.configure_level_and_format() logutils.configure_level_and_format()
...@@ -82,7 +84,11 @@ def main( ...@@ -82,7 +84,11 @@ def main(
jinja2_file_loader = jinja2.FileSystemLoader(".") jinja2_file_loader = jinja2.FileSystemLoader(".")
jinja2_env = jinja2.Environment(loader=jinja2_file_loader) jinja2_env = jinja2.Environment(loader=jinja2_file_loader)
template = jinja2_env.get_template("./_static/clusters.html.jinja")
try:
template = jinja2_env.get_template(jinja_cluster_template_file)
except jinja2.exceptions.TemplateNotFound as exception:
raise RuntimeError("Couldn't load Jinja2 template {}. Should have been created by mu-init.".format(jinja_cluster_template_file))
# output = template.render(colors=colors) # output = template.render(colors=colors)
# print(output) # print(output)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment