From 66a0a713319f1727ae5c54195298c872ce6f8bfd Mon Sep 17 00:00:00 2001 From: danny-b-livesmart <39330064+danny-b-livesmart@users.noreply.github.com> Date: Fri, 26 Jul 2019 12:31:59 +0100 Subject: [PATCH 1/2] Updating import paths for twilio package >6.x Twilio package >6.x has changed the locations for TwilioRestClient & TwilioRestException. --- deux/notifications.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/deux/notifications.py b/deux/notifications.py index 50a9c1d..d9f3384 100644 --- a/deux/notifications.py +++ b/deux/notifications.py @@ -1,7 +1,18 @@ from __future__ import absolute_import, unicode_literals -from twilio.rest import TwilioRestClient -from twilio.rest.exceptions import TwilioRestException +try: + from twilio.rest import Client as TwilioRestClient +except ImportError: + from twilio.rest import TwilioRestClient + print("DeprecationWarning: Importing TwilioRestClient from twilio.rest" + " is deprecated. Update twilio package to >6.x") + +try: + from twilio.base.exceptions import TwilioRestException +except ImportError: + from twilio.rest.exceptions import TwilioRestException + print("DeprecationWarning: Importing TwilioRestException from twilio.rest" + " is deprecated. Update twilio package to >6.x") from deux import strings from deux.app_settings import mfa_settings From 05739e5389be1e1d6ad02754da4248870f405641 Mon Sep 17 00:00:00 2001 From: danny-b-livesmart <39330064+danny-b-livesmart@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:33:58 +0000 Subject: [PATCH 2/2] Alter phone number regex to support E164 format To support international phone numbers (E164 format), the regex needs updating to allow for the "+" character. --- deux/validators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deux/validators.py b/deux/validators.py index 60ddd1b..265d373 100644 --- a/deux/validators.py +++ b/deux/validators.py @@ -6,5 +6,5 @@ #: Regex validator for phone numbers. phone_number_validator = RegexValidator( - regex=r"^(\d{7,15})$", + regex=r"^\+[1-9]\d{1,14}$", message=strings.INVALID_PHONE_NUMBER_ERROR)