From 8dac171bcf628d4f25f71794c8d0b30bb2a2b0ae Mon Sep 17 00:00:00 2001 From: mshivashankar Date: Fri, 2 Feb 2024 10:32:41 +0100 Subject: [PATCH 1/2] Bad templates to be stored in library --- library/Templates/Email/syntax_error_template.md | 4 ++++ .../Templates/Email/undefined_variable_error.html | 14 ++++++++++++++ library/Templates/MSTeams/syntax_error_template.md | 4 ++++ library/Templates/Slack/syntax_error_template.md | 4 ++++ .../Templates/Slack/undefined_variable_error.txt | 2 ++ 5 files changed, 28 insertions(+) create mode 100644 library/Templates/Email/syntax_error_template.md create mode 100644 library/Templates/Email/undefined_variable_error.html create mode 100644 library/Templates/MSTeams/syntax_error_template.md create mode 100644 library/Templates/Slack/syntax_error_template.md create mode 100644 library/Templates/Slack/undefined_variable_error.txt diff --git a/library/Templates/Email/syntax_error_template.md b/library/Templates/Email/syntax_error_template.md new file mode 100644 index 00000000..95d9649e --- /dev/null +++ b/library/Templates/Email/syntax_error_template.md @@ -0,0 +1,4 @@ +{# Incorrect Jinja2 syntax (missing endfor) which will raise a TemplateSyntaxError #} +{% for item in some_list %} + {{ item }} +{# Missing {% endfor %} here #} diff --git a/library/Templates/Email/undefined_variable_error.html b/library/Templates/Email/undefined_variable_error.html new file mode 100644 index 00000000..d8754e3f --- /dev/null +++ b/library/Templates/Email/undefined_variable_error.html @@ -0,0 +1,14 @@ + + + + + Undefined Error Example + + +

Attempting to Access an Undefined Variable

+

+ {# Accessing an undefined variable here #} + {{ non_existent_variable + non_existent_variable }} +

+ + diff --git a/library/Templates/MSTeams/syntax_error_template.md b/library/Templates/MSTeams/syntax_error_template.md new file mode 100644 index 00000000..95d9649e --- /dev/null +++ b/library/Templates/MSTeams/syntax_error_template.md @@ -0,0 +1,4 @@ +{# Incorrect Jinja2 syntax (missing endfor) which will raise a TemplateSyntaxError #} +{% for item in some_list %} + {{ item }} +{# Missing {% endfor %} here #} diff --git a/library/Templates/Slack/syntax_error_template.md b/library/Templates/Slack/syntax_error_template.md new file mode 100644 index 00000000..95d9649e --- /dev/null +++ b/library/Templates/Slack/syntax_error_template.md @@ -0,0 +1,4 @@ +{# Incorrect Jinja2 syntax (missing endfor) which will raise a TemplateSyntaxError #} +{% for item in some_list %} + {{ item }} +{# Missing {% endfor %} here #} diff --git a/library/Templates/Slack/undefined_variable_error.txt b/library/Templates/Slack/undefined_variable_error.txt new file mode 100644 index 00000000..ea12e40f --- /dev/null +++ b/library/Templates/Slack/undefined_variable_error.txt @@ -0,0 +1,2 @@ +{# Attempt to access an undefined variable, which will raise an UndefinedError in Jinja2 #} +{{ non_existent_variable + non_existent_variable }} From 0b76a87d546c4a51e71801b354cff1b03ccce9f3 Mon Sep 17 00:00:00 2001 From: mshivashankar Date: Wed, 7 Feb 2024 09:37:05 +0100 Subject: [PATCH 2/2] add more bad templates --- .../Templates/Attachment/syntax_error_template.md | 4 ++++ .../Attachment/undefined_variable_error.html | 14 ++++++++++++++ library/Templates/General/syntax_error_template.md | 4 ++++ .../General/undefined_variable_error.html | 14 ++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 library/Templates/Attachment/syntax_error_template.md create mode 100644 library/Templates/Attachment/undefined_variable_error.html create mode 100644 library/Templates/General/syntax_error_template.md create mode 100644 library/Templates/General/undefined_variable_error.html diff --git a/library/Templates/Attachment/syntax_error_template.md b/library/Templates/Attachment/syntax_error_template.md new file mode 100644 index 00000000..95d9649e --- /dev/null +++ b/library/Templates/Attachment/syntax_error_template.md @@ -0,0 +1,4 @@ +{# Incorrect Jinja2 syntax (missing endfor) which will raise a TemplateSyntaxError #} +{% for item in some_list %} + {{ item }} +{# Missing {% endfor %} here #} diff --git a/library/Templates/Attachment/undefined_variable_error.html b/library/Templates/Attachment/undefined_variable_error.html new file mode 100644 index 00000000..d8754e3f --- /dev/null +++ b/library/Templates/Attachment/undefined_variable_error.html @@ -0,0 +1,14 @@ + + + + + Undefined Error Example + + +

Attempting to Access an Undefined Variable

+

+ {# Accessing an undefined variable here #} + {{ non_existent_variable + non_existent_variable }} +

+ + diff --git a/library/Templates/General/syntax_error_template.md b/library/Templates/General/syntax_error_template.md new file mode 100644 index 00000000..95d9649e --- /dev/null +++ b/library/Templates/General/syntax_error_template.md @@ -0,0 +1,4 @@ +{# Incorrect Jinja2 syntax (missing endfor) which will raise a TemplateSyntaxError #} +{% for item in some_list %} + {{ item }} +{# Missing {% endfor %} here #} diff --git a/library/Templates/General/undefined_variable_error.html b/library/Templates/General/undefined_variable_error.html new file mode 100644 index 00000000..d8754e3f --- /dev/null +++ b/library/Templates/General/undefined_variable_error.html @@ -0,0 +1,14 @@ + + + + + Undefined Error Example + + +

Attempting to Access an Undefined Variable

+

+ {# Accessing an undefined variable here #} + {{ non_existent_variable + non_existent_variable }} +

+ +