mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
Upgrade utils to 48.0.0
Fixes a bug with non breaking spaces being removed from templates
This commit is contained in:
+5
-2
@@ -24,7 +24,10 @@ from govuk_frontend_jinja.flask_ext import init_govuk_frontend
|
||||
from itsdangerous import BadSignature
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from notifications_utils import logging, request_helper
|
||||
from notifications_utils.formatters import formatted_list, normalise_lines
|
||||
from notifications_utils.formatters import (
|
||||
formatted_list,
|
||||
get_lines_with_normalised_whitespace,
|
||||
)
|
||||
from notifications_utils.recipients import format_phone_number_human_readable
|
||||
from notifications_utils.sanitise_text import SanitiseASCII
|
||||
from werkzeug.exceptions import HTTPException as WerkzeugHTTPException
|
||||
@@ -553,7 +556,7 @@ def add_template_filters(application):
|
||||
format_notification_status_as_url,
|
||||
format_number_in_pounds_as_currency,
|
||||
formatted_list,
|
||||
normalise_lines,
|
||||
get_lines_with_normalised_whitespace,
|
||||
nl2br,
|
||||
format_phone_number_human_readable,
|
||||
format_thousands,
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ from flask_wtf.file import FileAllowed
|
||||
from flask_wtf.file import FileField as FileField_wtf
|
||||
from notifications_utils.columns import Columns
|
||||
from notifications_utils.countries.data import Postage
|
||||
from notifications_utils.formatters import strip_whitespace
|
||||
from notifications_utils.formatters import strip_all_whitespace
|
||||
from notifications_utils.postal_address import PostalAddress
|
||||
from notifications_utils.recipients import (
|
||||
InvalidPhoneError,
|
||||
@@ -551,7 +551,7 @@ class StripWhitespaceForm(Form):
|
||||
# FieldList simply doesn't support filters.
|
||||
# @see: https://github.com/wtforms/wtforms/issues/148
|
||||
no_filter_fields = (FieldList, PasswordField, GovukPasswordField)
|
||||
filters = [strip_whitespace] if not issubclass(unbound_field.field_class, no_filter_fields) else []
|
||||
filters = [strip_all_whitespace] if not issubclass(unbound_field.field_class, no_filter_fields) else []
|
||||
filters += unbound_field.kwargs.get('filters', [])
|
||||
bound = unbound_field.bind(form=form, filters=filters, **options)
|
||||
bound.get_form = weakref.ref(form) # GC won't collect the form if we don't use a weakref
|
||||
@@ -567,7 +567,7 @@ class StripWhitespaceStringField(GovukTextInputField):
|
||||
kwargs['filters'] = tuple(chain(
|
||||
kwargs.get('filters', ()),
|
||||
(
|
||||
strip_whitespace,
|
||||
strip_all_whitespace,
|
||||
),
|
||||
))
|
||||
super(GovukTextInputField, self).__init__(label, **kwargs)
|
||||
|
||||
@@ -2,7 +2,7 @@ from functools import partial
|
||||
from os import path
|
||||
|
||||
from flask import abort, current_app
|
||||
from notifications_utils.formatters import strip_whitespace
|
||||
from notifications_utils.formatters import strip_all_whitespace
|
||||
from notifications_utils.recipients import RecipientCSV
|
||||
from werkzeug.utils import cached_property
|
||||
|
||||
@@ -56,7 +56,7 @@ class ContactList(JSONModel):
|
||||
|
||||
@staticmethod
|
||||
def download(service_id, upload_id):
|
||||
return strip_whitespace(s3download(
|
||||
return strip_all_whitespace(s3download(
|
||||
service_id,
|
||||
upload_id,
|
||||
bucket=ContactList.get_bucket_name(),
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% if letter_contact_details|length > 1 %}
|
||||
{% set first_line_of_contact_block = item.contact_block|normalise_lines|first %}
|
||||
{% set first_line_of_contact_block = item.contact_block|get_lines_with_normalised_whitespace|first %}
|
||||
{{ copy_to_clipboard(item.id, name=first_line_of_contact_block, thing="ID") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ importlib-metadata==4.2.0
|
||||
awscli-cwlogs>=1.4,<1.5
|
||||
itsdangerous==1.1.0 # pyup: <2
|
||||
|
||||
git+https://github.com/alphagov/notifications-utils.git@47.0.1#egg=notifications-utils==47.0.1
|
||||
git+https://github.com/alphagov/notifications-utils.git@48.0.0#egg=notifications-utils==48.0.0
|
||||
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.8-alpha#egg=govuk-frontend-jinja==0.5.8-alpha
|
||||
|
||||
# cryptography 3.4+ incorporates Rust code, which isn't supported on PaaS
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ mistune==0.8.4
|
||||
# via notifications-utils
|
||||
notifications-python-client==6.3.0
|
||||
# via -r requirements.in
|
||||
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@47.0.1
|
||||
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@48.0.0
|
||||
# via -r requirements.in
|
||||
openpyxl==3.0.7
|
||||
# via pyexcel-xlsx
|
||||
|
||||
@@ -2295,8 +2295,8 @@ def test_send_one_off_letter_address_shows_form(
|
||||
}),
|
||||
# it ignores empty lines and strips whitespace from each line.
|
||||
# It also strips extra whitespace from the middle of lines.
|
||||
('\n a\ta \n\n\n \n\n\n\nb b \r\n sw1a1aa \n\n', {
|
||||
'address_line_1': 'a\ta',
|
||||
('\n a\ta \n\n\n \n\n\n\nb b \r\n sw1a\u00A01aa \n\n', {
|
||||
'address_line_1': 'a a',
|
||||
'address_line_2': 'b b',
|
||||
'address_line_3': '',
|
||||
'address_line_4': '',
|
||||
|
||||
Reference in New Issue
Block a user