Revision 8fb8d0cf snf-astakos-app/astakos/im/notifications.py

b/snf-astakos-app/astakos/im/notifications.py
44 44

  
45 45
logger = logging.getLogger(__name__)
46 46

  
47
def build_notification(
48
    sender, recipients, subject, message=None, template=None, dictionary=None):
47

  
48
def build_notification(sender, recipients, subject, message=None,
49
                       template=None, dictionary=None):
49 50
    return EmailNotification(
50 51
        sender, recipients, subject, message, template, dictionary)
51 52

  
53

  
52 54
class Notification(object):
53
    def __init__(
54
        self, sender, recipients, subject,
55
        message=None, template=None, dictionary=None):
55
    def __init__(self, sender, recipients, subject,
56
                 message=None, template=None, dictionary=None):
56 57
        if not message and not template:
57 58
            raise IOError('message and template cannot be both None.')
58 59
        dictionary = dictionary or {}
......
64 65
    def send(self):
65 66
        pass
66 67

  
68

  
67 69
class EmailNotification(Notification):
68 70
    def send(self):
69 71
        try:
......
77 79
            logger.exception(e)
78 80
            raise NotificationError(self)
79 81

  
82

  
80 83
class NotificationError(Exception):
81 84
    def __init__(self, nofication):
82
        self.message = _(astakos_messages.DETAILED_NOTIFICATION_SEND_ERR) % nofication.__dict__
85
        self.message = (_(astakos_messages.DETAILED_NOTIFICATION_SEND_ERR) %
86
                        nofication.__dict__)
83 87
        super(NotificationError, self).__init__()
84

  

Also available in: Unified diff