Changeset 5:573fdae8b1f6 in mailjam for postman/models.py
- Timestamp:
- May 16, 2012, 11:41:47 AM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postman/models.py
r4 r5 33 33 """ 34 34 35 def __init__(self, name, address, members={}, config={} , storage=None):35 def __init__(self, name, address, members={}, config={}): 36 36 self.name = name 37 37 self.address = address … … 39 39 self.config = config 40 40 self._validate_config() # validate the config parameters 41 self.storage = Storage(os.path.join(self.config['storage'],42 self.address))43 self.archive = Storage(os.path.join(self.config['archive'],44 self.address))45 41 46 42 def __repr__(self): … … 72 68 raise ValueError(address, ' is not a valid email address') 73 69 return address in self.members_addresses() 74 70 71 @property 72 def storage(self): 73 return Storage(os.path.join(self.config['storage'], self.address)) 74 75 @property 76 def archive(self): 77 return Storage(os.path.join(self.config['archive'], self.address)) 78 75 79 def members_addresses(self): 76 80 return self.members.keys() … … 97 101 return True 98 102 103 def info(self): 104 """ 105 Returns a dict we can use to add this mailing list to a postman 106 instance 107 """ 108 # FIXME: This code could be replaced with something that 109 # automagically generates the dict from the instance attributes 110 return {'name': self.name, 'address': self.address, 111 'members': self.members, 'config': self.config} 112 99 113 def load(self): 100 114 if self.storage.exists():
Note:
See TracChangeset
for help on using the changeset viewer.