Projet

Général

Profil

Télécharger (916 octets) Statistiques
| Branche: | Tag: | Révision:

root / corbo / channels.py @ f38ae358

1
from django.utils.translation import ugettext_lazy as _
2

    
3
def get_channel_choices(include=[], exclude=[]):
4
    for channel in HomepageChannel, SMSChannel, EmailChannel:
5
        if include and channel.identifier not in include:
6
            continue
7
        if exclude and channel.identifier in exclude:
8
            continue
9
        for identifier, display_name in channel.get_choices():
10
            yield (identifier, display_name)
11

    
12
class HomepageChannel(object):
13
    identifier = 'homepage'
14

    
15
    @classmethod
16
    def get_choices(self):
17
        return (('homepage', _('Homepage')),)
18

    
19
class SMSChannel(object):
20

    
21
    @classmethod
22
    def get_choices(self):
23
        return (('sms', _('SMS')),)
24

    
25
    def send(self, announce):
26
        pass
27

    
28
class EmailChannel(object):
29
    identifier = 'email'
30

    
31
    @classmethod
32
    def get_choices(self):
33
        return (('email', _('Email')),)
34

    
35
    def send(self, announce):
36
        pass
(2-2/11)