From e8b134b8f34a8226dd512ecc96a6c908d712663b Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 24 Jun 2017 21:57:16 +0000 Subject: IListManager.get() now accepts both List-IDs and FQDN list names. --- src/mailman/model/listmanager.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/mailman/model/listmanager.py') diff --git a/src/mailman/model/listmanager.py b/src/mailman/model/listmanager.py index 885e5c284..e20598f81 100644 --- a/src/mailman/model/listmanager.py +++ b/src/mailman/model/listmanager.py @@ -59,17 +59,24 @@ class ListManager: return mlist @dbconnection - def get(self, store, fqdn_listname): + def get(self, store, list_spec): """See `IListManager`.""" - listname, at, hostname = fqdn_listname.partition('@') - list_id = '{}.{}'.format(listname, hostname) - return store.query(MailingList).filter_by(_list_id=list_id).first() + return (self.get_by_fqdn(list_spec) + if '@' in list_spec + else self.get_by_list_id(list_spec)) @dbconnection def get_by_list_id(self, store, list_id): """See `IListManager`.""" return store.query(MailingList).filter_by(_list_id=list_id).first() + @dbconnection + def get_by_fqdn(self, store, fqdn_listname): + """See `IListManager`.""" + listname, at, hostname = fqdn_listname.partition('@') + list_id = '{}.{}'.format(listname, hostname) + return store.query(MailingList).filter_by(_list_id=list_id).first() + @dbconnection def delete(self, store, mlist): """See `IListManager`.""" -- cgit v1.2.3-70-g09d2