diff options
Diffstat (limited to 'src/mailman/model/listmanager.py')
| -rw-r--r-- | src/mailman/model/listmanager.py | 15 |
1 files changed, 11 insertions, 4 deletions
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,11 +59,11 @@ 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): @@ -71,6 +71,13 @@ class ListManager: 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`.""" fqdn_listname = mlist.fqdn_listname |
