Changeset 20:bf238ca0c37f in mailjam
- Timestamp:
- May 22, 2012, 1:28:15 PM (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- mailjam
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
mailjam/config.py
r16 r20 42 42 'mailing_lists', 'members'] 43 43 44 def validate_configfile(self): 44 def validate_configfile(self): 45 45 if self.configfile: 46 # ensure we have the full path to the provided file 47 self.configfile = os.path.join(os.path.dirname(__file__), 48 self.configfile) 46 49 if not os.path.exists(self.configfile): 47 50 # the file does not exist, so we override it with None, … … 49 52 # config file on the usual places 50 53 self.configfile = None 54 else: 55 return self.configfile 51 56 52 57 if not self.configfile: … … 56 61 self.configfile = full_path 57 62 return full_path 58 63 59 64 # if we reach here, self.configfile will be still None, no valid 60 65 # config files were found, and so we raise an exception -
mailjam/daemon.py
r16 r20 1 1 # -*- coding: utf-8 -*- 2 3 """ 4 The mailjam project - daemon.py 5 6 This file is released under the BSD license, see LICENSE for 7 more information. 8 9 Francisco de Borja Lopez Rio - <borja@codigo23.net> 10 Soluciones Informaticas Codigo23 S.L.U. - http://codigo23.net 11 """ 2 12 3 13 import os, inspect, logging … … 12 22 13 23 def __init__(self, configfile=None): 24 self.configfile=configfile 14 25 self.storage_config = config.get_config_parameters('storage', 15 26 configfile) … … 54 65 # now load all the mailing objects: 55 66 for address in self.mailings_addresses: 56 mailing = MailingList(address, address) 67 mailing = MailingList(name=address, address=address, 68 configfile=self.configfile) 57 69 mailing.load() 58 70 self.mailings[address] = mailing … … 146 158 """ 147 159 160 def __init__(self, configfile=None): 161 self.configfile = configfile 162 148 163 def _listMethods(self): 149 164 public_methods = [] … … 158 173 159 174 class MailingListXMLRPC(): 160 def __init__(self ):161 self.mailjam = Mailjam( )175 def __init__(self, configfile=None): 176 self.mailjam = Mailjam(configfile=configfile) 162 177 self.mailjam.load() 163 178 def add(self, info={}): … … 168 183 169 184 class MemberXMLRPC(): 170 def __init__(self ):171 self.mailjam = Mailjam( )185 def __init__(self, configfile=None): 186 self.mailjam = Mailjam(configfile=configfile) 172 187 self.mailjam.load() 173 188 def add(self, member_addr=None, list_addr=None): … … 180 195 class MailjamDaemon(): 181 196 def __init__(self, configfile=None): 197 self.configfile = configfile 182 198 self.config = config.get_config_parameters('xmlrpc_server', configfile) 183 184 # FIXME: These should be loaded from a config file185 199 self.address = self.config.get('address', 'localhost') 186 200 self.port = int(self.config.get('port', 9876)) … … 221 235 msg = 'Registering public methods' 222 236 logging.info(msg) 223 root = MailjamXMLRPC( )224 root.lists = MailingListXMLRPC( )225 root.members = MemberXMLRPC( )237 root = MailjamXMLRPC(self.configfile) 238 root.lists = MailingListXMLRPC(self.configfile) 239 root.members = MemberXMLRPC(self.configfile) 226 240 self.server.register_instance(root, allow_dotted_names=True) 227 241 self.ready_to_serve = True -
mailjam/mta.py
r16 r20 23 23 raise ValueError(address, ' is not a valid email address') 24 24 25 mta_config = MTAClientConfig( )25 mta_config = MTAClientConfig(configfile=configfile) 26 26 mta_config.load() 27 27 self.config = mta_config.config
Note:
See TracChangeset
for help on using the changeset viewer.