From 61e592ceb4208fc6212e000607914fcfb9e12140 Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Fri, 8 Jan 2021 21:11:01 +0200 Subject: [PATCH 01/12] Rename all formgrader templates from .tpl to .html.j2 - From #1373, thanks @gzagatti - I can't quickly find the latest version of jinja2 that requires this --- .../formgrader/templates/{base.tpl => base.html.j2} | 0 .../formgrader/templates/{base_403.tpl => base_403.html.j2} | 0 .../formgrader/templates/{base_500.tpl => base_500.html.j2} | 0 .../formgrader/templates/{feedback.tpl => feedback.html.j2} | 0 .../formgrader/templates/{formgrade.tpl => formgrade.html.j2} | 0 .../templates/{formgrade_404.tpl => formgrade_404.html.j2} | 0 .../templates/{formgrade_macros.tpl => formgrade_macros.html.j2} | 0 .../{gradebook_assignments.tpl => gradebook_assignments.html.j2} | 0 .../templates/{gradebook_base.tpl => gradebook_base.html.j2} | 0 ...ook_submissions.tpl => gradebook_notebook_submissions.html.j2} | 0 .../{gradebook_notebooks.tpl => gradebook_notebooks.html.j2} | 0 .../{manage_assignments.tpl => manage_assignments.html.j2} | 0 .../templates/{manage_students.tpl => manage_students.html.j2} | 0 ...udents_assignments.tpl => manage_students_assignments.html.j2} | 0 .../{manage_students_base.tpl => manage_students_base.html.j2} | 0 ...bmissions.tpl => manage_students_notebook_submissions.html.j2} | 0 .../{manage_submissions.tpl => manage_submissions.html.j2} | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename nbgrader/server_extensions/formgrader/templates/{base.tpl => base.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{base_403.tpl => base_403.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{base_500.tpl => base_500.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{feedback.tpl => feedback.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{formgrade.tpl => formgrade.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{formgrade_404.tpl => formgrade_404.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{formgrade_macros.tpl => formgrade_macros.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{gradebook_assignments.tpl => gradebook_assignments.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{gradebook_base.tpl => gradebook_base.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{gradebook_notebook_submissions.tpl => gradebook_notebook_submissions.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{gradebook_notebooks.tpl => gradebook_notebooks.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_assignments.tpl => manage_assignments.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_students.tpl => manage_students.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_students_assignments.tpl => manage_students_assignments.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_students_base.tpl => manage_students_base.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_students_notebook_submissions.tpl => manage_students_notebook_submissions.html.j2} (100%) rename nbgrader/server_extensions/formgrader/templates/{manage_submissions.tpl => manage_submissions.html.j2} (100%) diff --git a/nbgrader/server_extensions/formgrader/templates/base.tpl b/nbgrader/server_extensions/formgrader/templates/base.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/base.tpl rename to nbgrader/server_extensions/formgrader/templates/base.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/base_403.tpl b/nbgrader/server_extensions/formgrader/templates/base_403.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/base_403.tpl rename to nbgrader/server_extensions/formgrader/templates/base_403.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/base_500.tpl b/nbgrader/server_extensions/formgrader/templates/base_500.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/base_500.tpl rename to nbgrader/server_extensions/formgrader/templates/base_500.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/feedback.tpl b/nbgrader/server_extensions/formgrader/templates/feedback.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/feedback.tpl rename to nbgrader/server_extensions/formgrader/templates/feedback.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/formgrade.tpl b/nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/formgrade.tpl rename to nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/formgrade_404.tpl b/nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/formgrade_404.tpl rename to nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/formgrade_macros.tpl b/nbgrader/server_extensions/formgrader/templates/formgrade_macros.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/formgrade_macros.tpl rename to nbgrader/server_extensions/formgrader/templates/formgrade_macros.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.tpl b/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/gradebook_assignments.tpl rename to nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_base.tpl b/nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/gradebook_base.tpl rename to nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.tpl b/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.tpl rename to nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_notebooks.tpl b/nbgrader/server_extensions/formgrader/templates/gradebook_notebooks.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/gradebook_notebooks.tpl rename to nbgrader/server_extensions/formgrader/templates/gradebook_notebooks.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_assignments.tpl b/nbgrader/server_extensions/formgrader/templates/manage_assignments.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_assignments.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_assignments.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_students.tpl b/nbgrader/server_extensions/formgrader/templates/manage_students.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_students.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_students.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.tpl b/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_students_assignments.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_students_base.tpl b/nbgrader/server_extensions/formgrader/templates/manage_students_base.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_students_base.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_students_base.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_students_notebook_submissions.tpl b/nbgrader/server_extensions/formgrader/templates/manage_students_notebook_submissions.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_students_notebook_submissions.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_students_notebook_submissions.html.j2 diff --git a/nbgrader/server_extensions/formgrader/templates/manage_submissions.tpl b/nbgrader/server_extensions/formgrader/templates/manage_submissions.html.j2 similarity index 100% rename from nbgrader/server_extensions/formgrader/templates/manage_submissions.tpl rename to nbgrader/server_extensions/formgrader/templates/manage_submissions.html.j2 From 5bcabda17b3a19be9a31d27e5c7caa84e15445d1 Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Fri, 8 Jan 2021 21:17:15 +0200 Subject: [PATCH 02/12] formgrader: fix template_paths setting - Solution from #1373, thanks to @gzagatti - I don't know how or why this works --- nbgrader/server_extensions/formgrader/formgrader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbgrader/server_extensions/formgrader/formgrader.py b/nbgrader/server_extensions/formgrader/formgrader.py index 7ba769aef..9fbe37280 100644 --- a/nbgrader/server_extensions/formgrader/formgrader.py +++ b/nbgrader/server_extensions/formgrader/formgrader.py @@ -26,7 +26,7 @@ def _classes_default(self): def build_extra_config(self): extra_config = super(FormgradeExtension, self).build_extra_config() extra_config.HTMLExporter.template_file = 'formgrade' - extra_config.HTMLExporter.template_path = [handlers.template_path] + extra_config.HTMLExporter.template_paths.append(handlers.template_path) return extra_config def init_tornado_settings(self, webapp): From 22a0e08f87f63b611f921c543fcacfc896aea00b Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Fri, 8 Jan 2021 21:41:10 +0200 Subject: [PATCH 03/12] formgrader templates: inside the templates, change from *.tpl to *.html.j2 - Necessary when renaming templates --- .../server_extensions/formgrader/templates/base_403.html.j2 | 2 +- .../server_extensions/formgrader/templates/base_500.html.j2 | 2 +- .../server_extensions/formgrader/templates/feedback.html.j2 | 4 ++-- .../formgrader/templates/formgrade.html.j2 | 6 +++--- .../formgrader/templates/formgrade_404.html.j2 | 2 +- .../formgrader/templates/gradebook_assignments.html.j2 | 2 +- .../formgrader/templates/gradebook_base.html.j2 | 2 +- .../templates/gradebook_notebook_submissions.html.j2 | 2 +- .../formgrader/templates/gradebook_notebooks.html.j2 | 2 +- .../formgrader/templates/manage_assignments.html.j2 | 2 +- .../formgrader/templates/manage_students.html.j2 | 2 +- .../templates/manage_students_assignments.html.j2 | 2 +- .../formgrader/templates/manage_students_base.html.j2 | 2 +- .../templates/manage_students_notebook_submissions.html.j2 | 2 +- .../formgrader/templates/manage_submissions.html.j2 | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/nbgrader/server_extensions/formgrader/templates/base_403.html.j2 b/nbgrader/server_extensions/formgrader/templates/base_403.html.j2 index 6b29da31b..8178827c3 100644 --- a/nbgrader/server_extensions/formgrader/templates/base_403.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/base_403.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'base.tpl' -%} +{%- extends 'base.html.j2' -%} {%- block title -%} Not Authorized diff --git a/nbgrader/server_extensions/formgrader/templates/base_500.html.j2 b/nbgrader/server_extensions/formgrader/templates/base_500.html.j2 index 6dfe7789a..c4854a62d 100644 --- a/nbgrader/server_extensions/formgrader/templates/base_500.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/base_500.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'base.tpl' -%} +{%- extends 'base.html.j2' -%} {%- block title -%} Error diff --git a/nbgrader/server_extensions/formgrader/templates/feedback.html.j2 b/nbgrader/server_extensions/formgrader/templates/feedback.html.j2 index f28c54e5e..2c2bab29f 100644 --- a/nbgrader/server_extensions/formgrader/templates/feedback.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/feedback.html.j2 @@ -1,5 +1,5 @@ -{%- extends 'basic.tpl' -%} -{% from 'mathjax.tpl' import mathjax %} +{%- extends 'basic.html.j2' -%} +{% from 'mathjax.html.j2' import mathjax %} {%- block header -%} diff --git a/nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 b/nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 index 0822b7f72..60ea6b007 100644 --- a/nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/formgrade.html.j2 @@ -1,6 +1,6 @@ -{%- extends 'basic.tpl' -%} -{% from 'formgrade_macros.tpl' import nav, header %} -{% from 'mathjax.tpl' import mathjax %} +{%- extends 'basic.html.j2' -%} +{% from 'formgrade_macros.html.j2' import nav, header %} +{% from 'mathjax.html.j2' import mathjax %} {%- block header -%} diff --git a/nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 b/nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 index 0353bcefd..ed79f9a3b 100644 --- a/nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/formgrade_404.html.j2 @@ -1,4 +1,4 @@ -{% from 'formgrade_macros.tpl' import nav, header %} +{% from 'formgrade_macros.html.j2' import nav, header %} diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 b/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 index 06390b490..481f4fc9c 100644 --- a/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/gradebook_assignments.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'gradebook_base.tpl' -%} +{%- extends 'gradebook_base.html.j2' -%} {%- block head -%} diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 b/nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 index e280d7312..4f510c9fe 100644 --- a/nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/gradebook_base.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'base.tpl' -%} +{%- extends 'base.html.j2' -%} {%- block title -%} Manual Grading diff --git a/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 b/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 index caa8b640c..0bb1dce30 100644 --- a/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/gradebook_notebook_submissions.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'gradebook_base.tpl' -%} +{%- extends 'gradebook_base.html.j2' -%} {%- block head -%} diff --git a/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 b/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 index 90a7139a4..ff3b77a73 100644 --- a/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 +++ b/nbgrader/server_extensions/formgrader/templates/manage_students_assignments.html.j2 @@ -1,4 +1,4 @@ -{%- extends 'manage_students_base.tpl' -%} +{%- extends 'manage_students_base.html.j2' -%} {%- block head -%}