From 2bea8b55b42846a2f1142e32820c0fc3411bdb7f Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Wed, 8 Mar 2023 10:28:41 +0200 Subject: [PATCH] Adjust comment and method name --- temba/channels/types/twilio/views.py | 4 +++- temba/channels/views.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/temba/channels/types/twilio/views.py b/temba/channels/types/twilio/views.py index 686eaab68c3..debf351cc61 100644 --- a/temba/channels/types/twilio/views.py +++ b/temba/channels/types/twilio/views.py @@ -347,8 +347,10 @@ def __init__(self, *args, **kwargs): default="", ) - # We override the clean method for Twilio we need to make sure we grab the primary auth tokens def clean(self) -> Dict[str, Any]: + """ + We override the clean method for Twilio we need to make sure we grab the primary auth tokens + """ account_sid = self.cleaned_data.get("account_sid", None) account_token = self.cleaned_data.get("auth_token", None) diff --git a/temba/channels/views.py b/temba/channels/views.py index 6f187042002..a10d4d2861d 100644 --- a/temba/channels/views.py +++ b/temba/channels/views.py @@ -425,14 +425,17 @@ def add_config_field(self, config_key: str, field, *, default): self.fields[config_key] = field self.config_fields.append(config_key) - def transform_form_data_credentials_config(self, cleaned_data: dict, extra: dict) -> dict: + def creds_config(self, cleaned_data: dict, extra: dict) -> dict: + """ + Transform form data credentials to config format dict + """ config = cleaned_data.copy() config.update(**extra) return config def clean(self) -> dict[str, Any]: cleaned_data = super().clean() - credentials_config = self.transform_form_data_credentials_config(cleaned_data, {}) + credentials_config = self.creds_config(cleaned_data, {}) if not Channel.get_type_from_code(self.object.channel_type).check_credentials(credentials_config): raise ValidationError(_("Channel credentials don't appear to be valid.")) return cleaned_data