Skip to content

Commit db90cec

Browse files
authored
Merge pull request #1655 from GSA/intl_nums
fix default case for US numbers
2 parents 3ad7a3b + e93e3f3 commit db90cec

22 files changed

+105
-302
lines changed

app/clients/document_download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def upload_document(self, service_id, file_contents, is_csv=None):
3333
"document": file_contents,
3434
"is_csv": is_csv or False,
3535
},
36-
timeout=30
36+
timeout=30,
3737
)
3838

3939
response.raise_for_status()

app/clients/performance_platform/performance_platform_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def send_stats_to_performance_platform(self, payload):
2929
self.performance_platform_url + payload["dataType"],
3030
json=payload,
3131
headers=headers,
32-
timeout=30
32+
timeout=30,
3333
)
3434

3535
if resp.status_code == 200:

app/cronitor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def ping_cronitor(command):
3535
params={
3636
"host": current_app.config["API_HOST_NAME"],
3737
},
38-
timeout=30
38+
timeout=30,
3939
)
4040
resp.raise_for_status()
4141
except requests.RequestException as e:

app/delivery/send_to_providers.py

+11
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ def send_sms_to_provider(notification):
105105
# The future home of the validation is TBD
106106
_experimentally_validate_phone_numbers(recipient)
107107

108+
# TODO current we allow US phone numbers to be uploaded without the country code (1)
109+
# This will break certain international phone numbers (Norway, Denmark, East Timor)
110+
# When we officially announce support for international numbers, US numbers must contain
111+
# their country code.
112+
recipient = str(recipient)
113+
if len(recipient) == 10:
114+
if os.getenv("NOTIFY_ENVIRONMENT") not in [
115+
"test"
116+
]: # we want to test intl support
117+
recipient = f"1{recipient}"
118+
108119
sender_numbers = get_sender_numbers(notification)
109120
if notification.reply_to_text not in sender_numbers:
110121
raise ValueError(

migrations/versions/0216_remove_colours.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0216_remove_colours
33
Revises: 0215_email_brand_type
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
import sqlalchemy as sa
88
from alembic import op

migrations/versions/0219_default_email_branding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0219_default_email_branding
33
Revises: 0216_remove_colours
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
from alembic import op
88
from sqlalchemy import text

migrations/versions/0220_email_brand_type_non_null.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0220_email_brand_type_non_null
33
Revises: 0219_default_email_branding
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
from alembic import op
88

migrations/versions/0221_nullable_service_branding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0221_nullable_service_branding
33
Revises: 0220_email_brand_type_non_null
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
from alembic import op
88

migrations/versions/0222_drop_service_branding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0222_drop_service_branding
33
Revises: 0221_nullable_service_branding
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
import sqlalchemy as sa
88
from alembic import op

migrations/versions/0223_add_domain_constraint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revision ID: 0223_add_domain_constraint
33
Revises: 0222_drop_service_branding
44
Create Date: 2018-08-24 13:36:49.346156
5-
"""
5+
"""
66

77
from alembic import op
88

notifications_utils/formatters.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
from . import email_with_smart_quotes_regex
1313

1414
OBSCURE_ZERO_WIDTH_WHITESPACE = (
15-
"\u180E" # Mongolian vowel separator
16-
"\u200B" # zero width space
17-
"\u200C" # zero width non-joiner
18-
"\u200D" # zero width joiner
15+
"\u180e" # Mongolian vowel separator
16+
"\u200b" # zero width space
17+
"\u200c" # zero width non-joiner
18+
"\u200d" # zero width joiner
1919
"\u2060" # word joiner
20-
"\uFEFF" # zero width non-breaking space
20+
"\ufeff" # zero width non-breaking space
2121
)
2222

23-
OBSCURE_FULL_WIDTH_WHITESPACE = "\u00A0" # non breaking space
23+
OBSCURE_FULL_WIDTH_WHITESPACE = "\u00a0" # non breaking space
2424

2525
ALL_WHITESPACE = (
2626
string.whitespace + OBSCURE_ZERO_WIDTH_WHITESPACE + OBSCURE_FULL_WIDTH_WHITESPACE
@@ -61,7 +61,7 @@
6161
def unlink_govuk_escaped(message):
6262
return re.sub(
6363
govuk_not_a_link,
64-
r"\1\2\3" + ".\u200B" + r"\4", # Unicode zero-width space
64+
r"\1\2\3" + ".\u200b" + r"\4", # Unicode zero-width space
6565
message,
6666
)
6767

notifications_utils/sanitise_text.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class SanitiseText:
1515
"’": "'", # RIGHT SINGLE QUOTATION MARK (U+2019)
1616
"“": '"', # LEFT DOUBLE QUOTATION MARK (U+201C)
1717
"”": '"', # RIGHT DOUBLE QUOTATION MARK (U+201D)
18-
"\u180E": "", # Mongolian vowel separator
19-
"\u200B": "", # zero width space
20-
"\u200C": "", # zero width non-joiner
21-
"\u200D": "", # zero width joiner
18+
"\u180e": "", # Mongolian vowel separator
19+
"\u200b": "", # zero width space
20+
"\u200c": "", # zero width non-joiner
21+
"\u200d": "", # zero width joiner
2222
"\u2060": "", # word joiner
23-
"\uFEFF": "", # zero width non-breaking space
24-
"\u00A0": " ", # NON BREAKING WHITE SPACE (U+200B)
23+
"\ufeff": "", # zero width non-breaking space
24+
"\u00a0": " ", # NON BREAKING WHITE SPACE (U+200B)
2525
"\t": " ", # TAB
2626
}
2727

0 commit comments

Comments
 (0)