From fe098eca229f1c10dc7f2e8c455e17b95fd8b4be Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Thu, 20 Mar 2025 10:29:29 -0400 Subject: [PATCH 1/2] 1134 - Changing all instances of the word "brackets" to "parenthesis" --- app/main/validators.py | 4 +- app/main/views/templates.py | 4 +- .../templates/guidance-optional-content.html | 2 +- .../templates/guidance-personalization.html | 3 +- .../templates/guidance-send-a-document.html | 2 +- app/templates/views/check/column-errors.html | 2 +- .../how-to/edit-and-format-messages.html | 4 +- app/templates/views/how-to/index.html | 4 +- notifications_utils/field.py | 14 ++-- .../letter_pdf/_main_css.jinja2 | 2 +- notifications_utils/sanitise_text.py | 2 +- notifications_utils/template.py | 6 +- tests/app/main/test_validators.py | 2 +- tests/app/main/views/test_send.py | 2 +- tests/app/main/views/test_templates.py | 18 ++++- tests/notifications_utils/test_formatters.py | 4 +- tests/notifications_utils/test_markdown.py | 4 +- .../notifications_utils/test_placeholders.py | 4 +- .../test_recipient_validation.py | 2 +- .../test_template_types.py | 76 ++++++++++--------- 20 files changed, 92 insertions(+), 69 deletions(-) diff --git a/app/main/validators.py b/app/main/validators.py index 131c70a77..f47f03bd4 100644 --- a/app/main/validators.py +++ b/app/main/validators.py @@ -61,7 +61,7 @@ class ValidEmail: class NoCommasInPlaceHolders: - def __init__(self, message="You cannot put commas between double brackets"): + def __init__(self, message="You cannot put commas between double parenthesis"): self.message = message def __call__(self, form, field): @@ -127,7 +127,7 @@ class LettersNumbersSingleQuotesFullStopsAndUnderscoresOnly: def __call__(self, form, field): if field.data and not re.match(self.regex, field.data): - raise ValidationError(self.message) + raise ValidationError(self.parenthesis) class DoesNotStartWithDoubleZero: diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 3f779060d..83b4e9b25 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -698,7 +698,9 @@ def _get_content_count_error_and_message_for_template(template): # Check for blocked characters if contains_blocked_characters(template.content): warning = f"{s1}{s2}" - return False, Markup(warning) # 🚨 ONLY show the warning, hiding "Will be charged..." + return False, Markup( + warning + ) # 🚨 ONLY show the warning, hiding "Will be charged..." # If message is too long, return the length error if template.is_message_too_long(): diff --git a/app/templates/partials/templates/guidance-optional-content.html b/app/templates/partials/templates/guidance-optional-content.html index d3bc0dba5..6b74effcb 100644 --- a/app/templates/partials/templates/guidance-optional-content.html +++ b/app/templates/partials/templates/guidance-optional-content.html @@ -7,7 +7,7 @@

- Use double brackets and ‘??’ to define optional content. + Use double parenthesis and ‘??’ to define optional content.

For example if you only want to show something to people who are under diff --git a/app/templates/partials/templates/guidance-personalization.html b/app/templates/partials/templates/guidance-personalization.html index bc6a358a5..0c11906cd 100644 --- a/app/templates/partials/templates/guidance-personalization.html +++ b/app/templates/partials/templates/guidance-personalization.html @@ -7,11 +7,10 @@

- Use double brackets to personalize your message: + Use double parenthesis to personalize your message:

{{ usaInsetText({ "text": "Hello ((first name)), your reference is ((ref number))", "classes": ""}) }}
- diff --git a/app/templates/partials/templates/guidance-send-a-document.html b/app/templates/partials/templates/guidance-send-a-document.html index 3f839e378..d9841869a 100644 --- a/app/templates/partials/templates/guidance-send-a-document.html +++ b/app/templates/partials/templates/guidance-send-a-document.html @@ -4,7 +4,7 @@ Send a document by email

- Use double brackets to add a placeholder field to your template. This will contain a secure link to download the document. + Use double parenthesis to add a placeholder field to your template. This will contain a secure link to download the document.

{{ usaInsetText({ "text": "Download your document at: ((link_to_file))", diff --git a/app/templates/views/check/column-errors.html b/app/templates/views/check/column-errors.html index a24b5de3e..bcb518892 100644 --- a/app/templates/views/check/column-errors.html +++ b/app/templates/views/check/column-errors.html @@ -102,7 +102,7 @@ Error