for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
# -*- coding: utf-8 -*-
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
from tracim.lib.utils.logger import logger
from tracim.models.auth import User
from tracim.models.data import Content
class INotifier(object):
"""
Interface for Notifier instances
def __init__(self, config, current_user: User=None):
pass
def notify_content_update(self, content: Content):
raise NotImplementedError
class NotifierFactory(object):
__class__
@classmethod
def create(cls, config, current_user: User=None) -> INotifier:
if not config.EMAIL_NOTIFICATION_ACTIVATED:
return DummyNotifier(config, current_user)
return EmailNotifier(config, current_user)
class DummyNotifier(INotifier):
send_count = 0
INotifier.__init__(config, current_user)
logger.info(self, 'Instantiating Dummy Notifier')
type(self).send_count += 1
logger.info(
self,
'Fake notifier, do not send notification for update of content {}'.format(content.content_id) # nopep8
This check looks for lines that are too long. You can specify the maximum line length.
)
class EmailNotifier(INotifier):
notify_content_update
INotifier
Methods which raise NotImplementedError should be overridden in concrete child classes.
NotImplementedError
# TODO - G.M [emailNotif] move and restore Email Notifier in another file.
TODO
FIXME
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.