Simplify getting name of email / sms providers

Previously we used a combination of "provider.name" and "get_name()"
which was confusing. Using a non-property function also gave me the
impression that the name was more dynamic than it actually is.
This commit is contained in:
Ben Thorner
2022-03-24 17:31:53 +00:00
parent eef4868651
commit e6e16a81d0
8 changed files with 22 additions and 20 deletions

View File

@@ -28,5 +28,6 @@ class EmailClient(Client):
def send_email(self, *args, **kwargs):
raise NotImplementedError('TODO Need to implement.')
def get_name(self):
@property
def name(self):
raise NotImplementedError('TODO Need to implement.')

View File

@@ -59,11 +59,11 @@ class AwsSesClient(EmailClient):
def init_app(self, region, statsd_client, *args, **kwargs):
self._client = boto3.client('ses', region_name=region)
super(AwsSesClient, self).__init__(*args, **kwargs)
self.name = 'ses'
self.statsd_client = statsd_client
def get_name(self):
return self.name
@property
def name(self):
return 'ses'
def send_email(self,
source,

View File

@@ -13,12 +13,12 @@ class AwsSesStubClientException(EmailClientException):
class AwsSesStubClient(EmailClient):
def init_app(self, region, statsd_client, stub_url):
self.name = 'ses'
self.statsd_client = statsd_client
self.url = stub_url
def get_name(self):
return self.name
@property
def name(self):
return 'ses'
def send_email(self,
source,