Package svnmailer :: Package notifier :: Module selector
[hide private]

Source Code for Module svnmailer.notifier.selector

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright 2005-2006 André Malo or his licensors, as applicable 
 4  # 
 5  # Licensed under the Apache License, Version 2.0 (the "License"); 
 6  # you may not use this file except in compliance with the License. 
 7  # You may obtain a copy of the License at 
 8  # 
 9  #     http://www.apache.org/licenses/LICENSE-2.0 
10  # 
11  # Unless required by applicable law or agreed to in writing, software 
12  # distributed under the License is distributed on an "AS IS" BASIS, 
13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14  # See the License for the specific language governing permissions and 
15  # limitations under the License. 
16  """ 
17  notifier selector module 
18  """ 
19  __author__    = "André Malo" 
20  __docformat__ = "epytext en" 
21  __all__       = ['Selector'] 
22   
23   
24 -class Selector(object):
25 """ Notifier selector class 26 27 @ivar _settings: The svnmailer settings 28 @type _settings: C{svnmailer.settings.Settings} 29 """ 30
31 - def __init__(self, settings):
32 """ Initialization 33 34 @param settings: the svnmailer settings 35 @type settings: C{svnmailer.settings.Settings} 36 """ 37 self._settings = settings
38 39
40 - def selectNotifiers(self, groupset):
41 """ Returns the initialized notifiers for the specified groupset 42 43 @param groupset: The groupset to process 44 @type groupset: C{list} 45 46 @return: The notifiers 47 @rtype: C{list} of C{svnmailer.notifier.*} 48 """ 49 from svnmailer.notifier import mail, news, cia_xmlrpc 50 51 notifiers = [] 52 53 notifiers.extend(mail.getNotifier(self._settings, groupset)) 54 notifiers.extend(news.getNotifier(self._settings, groupset)) 55 notifiers.extend(cia_xmlrpc.getNotifier(self._settings, groupset)) 56 57 # STDOUT as fallback 58 if not notifiers: 59 from svnmailer.notifier import stdout 60 notifiers.extend(stdout.getNotifier(self._settings, groupset)) 61 62 return notifiers
63