2018-01-22 00:55:32 +03:00
|
|
|
"""Example use cases package."""
|
|
|
|
|
|
|
|
|
2020-01-27 02:41:36 +03:00
|
|
|
class UseCase:
|
2018-01-22 00:55:32 +03:00
|
|
|
"""Abstract use case."""
|
|
|
|
|
|
|
|
def execute(self):
|
|
|
|
"""Execute use case handling."""
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
|
2020-01-27 02:41:36 +03:00
|
|
|
class SignupUseCase:
|
2018-01-22 00:55:32 +03:00
|
|
|
"""Sign up use cases registers users."""
|
|
|
|
|
|
|
|
def __init__(self, email_sender):
|
2020-01-26 22:22:43 +03:00
|
|
|
"""Initialize instance."""
|
2018-01-22 00:55:32 +03:00
|
|
|
self.email_sender = email_sender
|
|
|
|
|
|
|
|
def execute(self, email):
|
|
|
|
"""Execute use case handling."""
|
|
|
|
print('Sign up user {0}'.format(email))
|
|
|
|
self.email_sender.send(email, 'Welcome, "{}"'.format(email))
|