Your column names need to match the double brackets in your template
+ data-error-label="{{ upload_id }}">Your column names need to match the double parenthesis in your template
Your file is missing {{ recipients.missing_column_headers | formatted_list(
conjunction='and',
diff --git a/app/templates/views/how-to/edit-and-format-messages.html b/app/templates/views/how-to/edit-and-format-messages.html
index 7b1cab01c..d018aaa1c 100644
--- a/app/templates/views/how-to/edit-and-format-messages.html
+++ b/app/templates/views/how-to/edit-and-format-messages.html
@@ -61,7 +61,7 @@
- Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.
- Add a new template or choose an existing template and select Edit.
- - Add a placeholder using double brackets. For example: Hello ((first name)), your reference is ((ref number)).
+ - Add a placeholder using double parenthesis. For example: Hello ((first name)), your reference is ((ref number)).
- Select Save.
@@ -81,7 +81,7 @@
- Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.
- Add a new template or choose an existing template and select Edit.
- - Use double brackets and ?? to define optional content. For example, if you only want to show something to people who are under 18: ((under18??Please get your application signed by a parent or guardian.))
+ - Use double parenthesis and ?? to define optional content. For example, if you only want to show something to people who are under 18: ((under18??Please get your application signed by a parent or guardian.))
- Select Save.
diff --git a/app/templates/views/how-to/index.html b/app/templates/views/how-to/index.html
index aa2361cb6..847dc03ce 100644
--- a/app/templates/views/how-to/index.html
+++ b/app/templates/views/how-to/index.html
@@ -59,7 +59,7 @@ your recipient to manage their benefits and increase follow-through.
To personalize your content
- - Add a placeholder to your content by placing two brackets around the personalized elements.
+ - Add a placeholder to your content by placing two parenthesis around the personalized elements.
- You can manually enter the personalized content or you can upload a spreadsheet with the details and let Notify do the
work for you.
@@ -78,7 +78,7 @@ all or part of the message contingent upon specific criteria associated with the
To add conditional content
- - Use two brackets and ?? to define the conditional content.
+ - Use two parenthesis and ?? to define the conditional content.
- You can manually enter the conditional content or you can upload a spreadsheet with the personal details and let Notify
do the work for you.
diff --git a/notifications_utils/field.py b/notifications_utils/field.py
index c0ea50216..ff7f95f57 100644
--- a/notifications_utils/field.py
+++ b/notifications_utils/field.py
@@ -14,7 +14,7 @@ from notifications_utils.insensitive_dict import InsensitiveDict
class Placeholder:
def __init__(self, body):
- # body shouldn’t include leading/trailing brackets, like (( and ))
+ # body shouldn’t include leading/trailing parenthesis, like (( and ))
self.body = body.lstrip("(").rstrip(")")
@classmethod
@@ -70,14 +70,16 @@ class Field:
conditional_placeholder_tag = (
"
(({}??{}))"
)
- placeholder_tag_no_brackets = "
{}"
+ placeholder_tag_no_parenthesis = (
+ "
{}"
+ )
placeholder_tag_redacted = "
hidden"
def __init__(
self,
content,
values=None,
- with_brackets=True,
+ with_parenthesis=True,
html="strip",
markdown_lists=False,
redact_missing_personalisation=False,
@@ -85,8 +87,8 @@ class Field:
self.content = content
self.values = values
self.markdown_lists = markdown_lists
- if not with_brackets:
- self.placeholder_tag = self.placeholder_tag_no_brackets
+ if not with_parenthesis:
+ self.placeholder_tag = self.placeholder_tag_no_parenthesis
self.sanitizer = {
"strip": strip_html,
"escape": escape_html,
@@ -198,7 +200,7 @@ class PlainTextField(Field):
placeholder_tag = "(({}))"
conditional_placeholder_tag = "(({}??{}))"
- placeholder_tag_no_brackets = "{}"
+ placeholder_tag_no_parenthesis = "{}"
placeholder_tag_redacted = "[hidden]"
diff --git a/notifications_utils/jinja_templates/letter_pdf/_main_css.jinja2 b/notifications_utils/jinja_templates/letter_pdf/_main_css.jinja2
index c73684d32..f8dc57643 100644
--- a/notifications_utils/jinja_templates/letter_pdf/_main_css.jinja2
+++ b/notifications_utils/jinja_templates/letter_pdf/_main_css.jinja2
@@ -169,7 +169,7 @@
border-radius: 1.05em;
}
- .placeholder-no-brackets {
+ .placeholder-no-parenthesis {
display: inline;
background: #FD0;
color: #000;
diff --git a/notifications_utils/sanitise_text.py b/notifications_utils/sanitise_text.py
index 3e9da0764..8c1d1af36 100644
--- a/notifications_utils/sanitise_text.py
+++ b/notifications_utils/sanitise_text.py
@@ -68,7 +68,7 @@ class SanitiseText:
if decomposed != "" and "<" not in decomposed:
# decomposition lists the unicode code points a character is made up of, if it's made up of multiple
# points. For example the á character returns '0061 0301', as in, the character a, followed by a combining
- # acute accent. The decomposition might, however, also contain a decomposition mapping in angle brackets.
+ # acute accent. The decomposition might, however, also contain a decomposition mapping in angle parenthesis.
# For a full list of the types, see here: https://www.compart.com/en/unicode/decomposition.
# If it's got a mapping, we're not sure how best to downgrade it, so just see if it's in the
# REPLACEMENT_CHARACTERS map. If not, then it's probably a letter with a modifier, eg á
diff --git a/notifications_utils/template.py b/notifications_utils/template.py
index ec112173f..186733797 100644
--- a/notifications_utils/template.py
+++ b/notifications_utils/template.py
@@ -376,7 +376,7 @@ class SMSPreviewTemplate(BaseSMSTemplate):
"recipient": Field(
"((phone number))",
self.values,
- with_brackets=False,
+ with_parenthesis=False,
html="escape",
),
"show_recipient": self.show_recipient,
@@ -691,7 +691,7 @@ class EmailPreviewTemplate(BaseEmailTemplate):
"from_address": self.from_address,
"reply_to": self.reply_to,
"recipient": Field(
- "((email address))", self.values, with_brackets=False
+ "((email address))", self.values, with_parenthesis=False
),
"show_recipient": self.show_recipient,
}
@@ -779,7 +779,7 @@ class BaseLetterTemplate(SubjectMixin, Template):
self.address_block,
self.values,
html="escape",
- with_brackets=False,
+ with_parenthesis=False,
).splitlines()
@property
diff --git a/tests/app/main/test_validators.py b/tests/app/main/test_validators.py
index aaa79ad40..83f040fa5 100644
--- a/tests/app/main/test_validators.py
+++ b/tests/app/main/test_validators.py
@@ -56,7 +56,7 @@ def test_for_commas_in_placeholders(
):
with pytest.raises(ValidationError) as error:
NoCommasInPlaceHolders()(None, _gen_mock_field("Hello ((name,date))"))
- assert str(error.value) == "You cannot put commas between double brackets"
+ assert str(error.value) == "You cannot put commas between double parenthesis"
NoCommasInPlaceHolders()(None, _gen_mock_field("Hello ((name))"))
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py
index d957fa393..ac81050ad 100644
--- a/tests/app/main/views/test_send.py
+++ b/tests/app/main/views/test_send.py
@@ -775,7 +775,7 @@ def test_upload_csv_file_with_very_long_placeholder_shows_check_page_with_errors
+12028675109
""",
(
- "Your column names need to match the double brackets in your template "
+ "Your column names need to match the double parenthesis in your template "
"Your file is missing a column called ‘name’."
),
),
diff --git a/tests/notifications_utils/test_formatters.py b/tests/notifications_utils/test_formatters.py
index 61185d974..4a4119fa2 100644
--- a/tests/notifications_utils/test_formatters.py
+++ b/tests/notifications_utils/test_formatters.py
@@ -232,8 +232,8 @@ def test_bleach_doesnt_try_to_make_valid_html_before_cleaning():
# We let users use & because it’s often pasted in URLs
("?a=1&b=2", "?a=1&b=2"),
# We let users use ( and ) because otherwise it’s
- # impossible to put brackets in the body of conditional placeholders
- ("((var??(in brackets)))", "((var??(in brackets)))"),
+ # impossible to put parenthesis in the body of conditional placeholders
+ ("((var??(in parenthesis)))", "((var??(in parenthesis)))"),
],
)
def test_escaping_html_entities(
diff --git a/tests/notifications_utils/test_markdown.py b/tests/notifications_utils/test_markdown.py
index be1053725..6363253df 100644
--- a/tests/notifications_utils/test_markdown.py
+++ b/tests/notifications_utils/test_markdown.py
@@ -44,9 +44,9 @@ def test_makes_links_out_of_URLs(url):
),
),
(
- ("this link is in brackets (http://example.com)"),
+ ("this link is in parenthesis (http://example.com)"),
(
- "this link is in brackets "
+ "this link is in parenthesis "
'(
http://example.com)'
),
),
diff --git a/tests/notifications_utils/test_placeholders.py b/tests/notifications_utils/test_placeholders.py
index 348d2159a..f155bd5e5 100644
--- a/tests/notifications_utils/test_placeholders.py
+++ b/tests/notifications_utils/test_placeholders.py
@@ -8,8 +8,8 @@ from notifications_utils.field import Placeholder
@pytest.mark.parametrize(
("body", "expected"),
[
- ("((with-brackets))", "with-brackets"),
- ("without-brackets", "without-brackets"),
+ ("((with-parenthesis))", "with-parenthesis"),
+ ("without-parenthesis", "without-parenthesis"),
],
)
def test_placeholder_returns_name(body, expected):
diff --git a/tests/notifications_utils/test_recipient_validation.py b/tests/notifications_utils/test_recipient_validation.py
index ff48df775..f6747256e 100644
--- a/tests/notifications_utils/test_recipient_validation.py
+++ b/tests/notifications_utils/test_recipient_validation.py
@@ -136,7 +136,7 @@ invalid_email_addresses = (
"local-with-’-apostrophe@domain.com",
"local-with-”-quotes@domain.com",
"domain-starts-with-a-dot@.domain.com",
- "brackets(in)local@domain.com",
+ "parenthesis(in)local@domain.com",
"email-too-long-{}@example.com".format("a" * 320),
"incorrect-punycode@xn---something.com",
)
diff --git a/tests/notifications_utils/test_template_types.py b/tests/notifications_utils/test_template_types.py
index 1b119f216..8942a619d 100644
--- a/tests/notifications_utils/test_template_types.py
+++ b/tests/notifications_utils/test_template_types.py
@@ -894,13 +894,13 @@ def test_phone_templates_normalise_whitespace(template_class):
(
{},
[
- "
address line 1",
- "
address line 2",
- "
address line 3",
- "
address line 4",
- "
address line 5",
- "
address line 6",
- "
address line 7",
+ "
address line 1",
+ "
address line 2",
+ "
address line 3",
+ "
address line 4",
+ "
address line 5",
+ "
address line 6",
+ "
address line 7",
],
),
(
@@ -910,12 +910,12 @@ def test_phone_templates_normalise_whitespace(template_class):
},
[
"123 Fake Street",
- "
address line 2",
- "
address line 3",
- "
address line 4",
- "
address line 5",
+ "
address line 2",
+ "
address line 3",
+ "
address line 4",
+ "
address line 5",
"United Kingdom",
- "
address line 7",
+ "
address line 7",
],
),
(
@@ -1129,13 +1129,13 @@ def test_letter_image_renderer(
"image_url": "http://example.com/endpoint.png",
"page_numbers": expected_page_numbers,
"address": [
- "
address line 1",
- "
address line 2",
- "
address line 3",
- "
address line 4",
- "
address line 5",
- "
address line 6",
- "
address line 7",
+ "
address line 1",
+ "
address line 2",
+ "
address line 3",
+ "
address line 4",
+ "
address line 5",
+ "
address line 6",
+ "
address line 7",
],
"contact_block": "10 Downing Street",
"date": "12 December 2012",
@@ -1838,7 +1838,7 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
mock.call(
"subject", {}, html="escape", redact_missing_personalisation=False
),
- mock.call("((email address))", {}, with_brackets=False),
+ mock.call("((email address))", {}, with_parenthesis=False),
],
),
(
@@ -1855,7 +1855,9 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"sms",
{},
[
- mock.call("((phone number))", {}, with_brackets=False, html="escape"),
+ mock.call(
+ "((phone number))", {}, with_parenthesis=False, html="escape"
+ ),
mock.call(
"content", {}, html="escape", redact_missing_personalisation=False
),
@@ -1874,7 +1876,9 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"broadcast",
{},
[
- mock.call("((phone number))", {}, with_brackets=False, html="escape"),
+ mock.call(
+ "((phone number))", {}, with_parenthesis=False, html="escape"
+ ),
mock.call(
"content", {}, html="escape", redact_missing_personalisation=False
),
@@ -1906,7 +1910,7 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"((address line 7))"
),
{},
- with_brackets=False,
+ with_parenthesis=False,
html="escape",
),
mock.call(
@@ -1937,7 +1941,7 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"((address line 7))"
),
{},
- with_brackets=False,
+ with_parenthesis=False,
html="escape",
),
mock.call(
@@ -1973,7 +1977,7 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
mock.call(
"subject", {}, html="escape", redact_missing_personalisation=True
),
- mock.call("((email address))", {}, with_brackets=False),
+ mock.call("((email address))", {}, with_parenthesis=False),
],
),
(
@@ -1981,7 +1985,9 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"sms",
{"redact_missing_personalisation": True},
[
- mock.call("((phone number))", {}, with_brackets=False, html="escape"),
+ mock.call(
+ "((phone number))", {}, with_parenthesis=False, html="escape"
+ ),
mock.call(
"content", {}, html="escape", redact_missing_personalisation=True
),
@@ -1992,7 +1998,9 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"broadcast",
{"redact_missing_personalisation": True},
[
- mock.call("((phone number))", {}, with_brackets=False, html="escape"),
+ mock.call(
+ "((phone number))", {}, with_parenthesis=False, html="escape"
+ ),
mock.call(
"content", {}, html="escape", redact_missing_personalisation=True
),
@@ -2034,7 +2042,7 @@ def test_is_message_empty_email_and_letter_templates_tries_not_to_count_chars(
"((address line 7))"
),
{},
- with_brackets=False,
+ with_parenthesis=False,
html="escape",
),
mock.call(
@@ -2488,7 +2496,7 @@ def test_email_preview_shows_reply_to_address(extra_args):
@pytest.mark.parametrize(
("template_values", "expected_content"),
[
- ({}, "
email address"),
+ ({}, "
email address"),
({"email address": "test@example.com"}, "test@example.com"),
],
)
@@ -2558,11 +2566,11 @@ def test_email_preview_shows_recipient_address(
(
"
"
"- line 1
"
- '- address line 2
'
- '- address line 3
'
- '- address line 4
'
- '- address line 5
'
- '- address line 6
'
+ '- address line 2
'
+ '- address line 3
'
+ '- address line 4
'
+ '- address line 5
'
+ '- address line 6
'
# Postcode is not normalised until the address is complete
"- n1 4wq
"
"
"