diff options
| author | Barry Warsaw | 2012-01-27 16:21:43 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2012-01-27 16:21:43 -0500 |
| commit | 435c0a8ff1c0c624f41ebb623da744fe31174f01 (patch) | |
| tree | e9582fe7efe1267648ba9d626ca27fe891e277fb | |
| parent | c5fd671f502d440b211ce4b99366aaad8be5bd1b (diff) | |
| download | mailman-435c0a8ff1c0c624f41ebb623da744fe31174f01.tar.gz mailman-435c0a8ff1c0c624f41ebb623da744fe31174f01.tar.zst mailman-435c0a8ff1c0c624f41ebb623da744fe31174f01.zip | |
Storm now has a "load hook" which we can use to restore the rosters when the
MailingList is loaded from the database. We need to call this explicitly in
the constructor, but at least nothing else will ever need to call it.
Diffstat (limited to '')
| -rw-r--r-- | src/mailman/model/listmanager.py | 10 | ||||
| -rw-r--r-- | src/mailman/model/mailinglist.py | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/mailman/model/listmanager.py b/src/mailman/model/listmanager.py index 91d653982..09a079e3c 100644 --- a/src/mailman/model/listmanager.py +++ b/src/mailman/model/listmanager.py @@ -65,13 +65,9 @@ class ListManager: def get(self, fqdn_listname): """See `IListManager`.""" listname, at, hostname = fqdn_listname.partition('@') - mlist = config.db.store.find(MailingList, - list_name=listname, - mail_host=hostname).one() - if mlist is not None: - # XXX Fixme - mlist._restore() - return mlist + return config.db.store.find(MailingList, + list_name=listname, + mail_host=hostname).one() def delete(self, mlist): """See `IListManager`.""" diff --git a/src/mailman/model/mailinglist.py b/src/mailman/model/mailinglist.py index d506c2c00..57b1ad9e4 100644 --- a/src/mailman/model/mailinglist.py +++ b/src/mailman/model/mailinglist.py @@ -200,14 +200,17 @@ class MailingList(Model): self.mail_host = hostname # For the pending database self.next_request_id = 1 - self._restore() + # We need to set up the rosters. Normally, this method will get + # called when the MailingList object is loaded from the database, but + # that's not the case when the constructor is called. So, set up the + # rosters explicitly. + self.__storm_loaded__() self.personalize = Personalization.none self.real_name = string.capwords( SPACE.join(listname.split(UNDERSCORE))) makedirs(self.data_path) - # XXX FIXME - def _restore(self): + def __storm_loaded__(self): self.owners = roster.OwnerRoster(self) self.moderators = roster.ModeratorRoster(self) self.administrators = roster.AdministratorRoster(self) |
