python-dependency-injector/examples/miniapps/use_cases/example/use_cases.py
Roman Mogylatov c50322db02
178 dependencies container provider (#179)
* Add DependenciesContainer provider

* Remove bundles_v2 example

* Add use cases example

* Update changelog

* Update documentation requirements to use fixed version of sphinxcontrib-disqus

* Add use cases miniapp to docs

* Update changelog
2018-01-21 23:55:32 +02:00

23 lines
560 B
Python

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