python-dependency-injector/examples/miniapps/use_cases/example/use_cases.py
2020-01-26 18:41:36 -05:00

23 lines
552 B
Python

"""Example use cases package."""
class UseCase:
"""Abstract use case."""
def execute(self):
"""Execute use case handling."""
raise NotImplementedError()
class SignupUseCase:
"""Sign up use cases registers users."""
def __init__(self, email_sender):
"""Initialize instance."""
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))