summaryrefslogtreecommitdiff
path: root/src/mailman/model/listmanager.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-06-24 21:57:19 +0000
committerBarry Warsaw2017-06-24 21:57:19 +0000
commit8f8e4f0b1075a176892d3a74dd601cefc642a870 (patch)
tree9057e4acfb9b4db2c75542d13b41b8938ef99451 /src/mailman/model/listmanager.py
parent6a148f762d5ee4fd91505eb0aa165b759899019f (diff)
parente8b134b8f34a8226dd512ecc96a6c908d712663b (diff)
downloadmailman-8f8e4f0b1075a176892d3a74dd601cefc642a870.tar.gz
mailman-8f8e4f0b1075a176892d3a74dd601cefc642a870.tar.zst
mailman-8f8e4f0b1075a176892d3a74dd601cefc642a870.zip
Diffstat (limited to 'src/mailman/model/listmanager.py')
-rw-r--r--src/mailman/model/listmanager.py15
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