diff options
| author | Barry Warsaw | 2007-09-21 08:51:38 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2007-09-21 08:51:38 -0400 |
| commit | 65c64773d910b3b2a3e2a9b9db4669e57170ece2 (patch) | |
| tree | 1bb742b2dc5898e569e19d8967e8d51a5d5c0352 /Mailman/database/listmanager.py | |
| parent | 892316be3c09eec4a1f8117bfd9eb44bba1c9117 (diff) | |
| download | mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.tar.gz mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.tar.zst mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.zip | |
OMGW00T: After over a decade, the MailList mixin class is gone! Well,
mostly. It's no longer needed by anything in the test suite, and
therefore the list manager returns database MailingList objects
directly. The wrapper cruft has been removed.
To accomplish this, a couple of hacks were added to the Mailman.app
package, which will get cleaned up over time. The MailList module
itself (and its few remaining mixins) aren't yet removed from the tree
because some of the code is still not tested, and I want to leave this
code around until I've finished converting it.
Diffstat (limited to 'Mailman/database/listmanager.py')
| -rw-r--r-- | Mailman/database/listmanager.py | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/Mailman/database/listmanager.py b/Mailman/database/listmanager.py index d5a6303e6..0f6d7a9aa 100644 --- a/Mailman/database/listmanager.py +++ b/Mailman/database/listmanager.py @@ -17,7 +17,6 @@ """SQLAlchemy/Elixir based provider of IListManager.""" -import weakref import datetime from elixir import * @@ -34,9 +33,6 @@ from Mailman.interfaces import IListManager, IPending class ListManager(object): implements(IListManager) - def __init__(self): - self._objectmap = weakref.WeakKeyDictionary() - def create(self, fqdn_listname): listname, hostname = split_listname(fqdn_listname) mlist = MailingList.get_by(list_name=listname, @@ -45,30 +41,18 @@ class ListManager(object): raise Errors.MMListAlreadyExistsError(fqdn_listname) mlist = MailingList(fqdn_listname) mlist.created_at = datetime.datetime.now() - # Wrap the database model object in an application MailList object and - # return the latter. Keep track of the wrapper so we can clean it up - # when we're done with it. - from Mailman.MailList import MailList - wrapper = MailList(mlist) - self._objectmap[mlist] = wrapper - return wrapper + return mlist def delete(self, mlist): - # Delete the wrapped backing data. XXX It's kind of icky to reach - # into the MailList object this way. - mlist._data.delete() - mlist._data = None + mlist.delete() def get(self, fqdn_listname): listname, hostname = split_listname(fqdn_listname) - mlist = MailingList.get_by(list_name=listname, - host_name=hostname) - if not mlist: - return None - mlist._restore() - from Mailman.MailList import MailList - wrapper = self._objectmap.setdefault(mlist, MailList(mlist)) - return wrapper + mlist = MailingList.get_by(list_name=listname, host_name=hostname) + if mlist is not None: + # XXX Fixme + mlist._restore() + return mlist @property def mailing_lists(self): |
