summaryrefslogtreecommitdiff
path: root/src/mailman/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/commands')
-rw-r--r--src/mailman/commands/cli_lists.py5
-rw-r--r--src/mailman/commands/cli_members.py3
-rw-r--r--src/mailman/commands/docs/create.txt3
-rw-r--r--src/mailman/commands/docs/remove.txt3
4 files changed, 9 insertions, 5 deletions
diff --git a/src/mailman/commands/cli_lists.py b/src/mailman/commands/cli_lists.py
index 23fe0282b..991e9b439 100644
--- a/src/mailman/commands/cli_lists.py
+++ b/src/mailman/commands/cli_lists.py
@@ -27,6 +27,7 @@ __all__ = [
]
+from zope.component import getUtility
from zope.interface import implements
from mailman.Utils import maketext
@@ -76,7 +77,7 @@ class Lists:
def process(self, args):
"""See `ICLISubCommand`."""
mailing_lists = []
- list_manager = IListManager(config)
+ list_manager = getUtility(IListManager)
# Gather the matching mailing lists.
for fqdn_name in sorted(list_manager.names):
mlist = list_manager.get(fqdn_name)
@@ -252,7 +253,7 @@ remove any residual archives."""))
assert len(args.listname) == 1, (
'Unexpected positional arguments: %s' % args.listname)
fqdn_listname = args.listname[0]
- mlist = IListManager(config).get(fqdn_listname)
+ mlist = getUtility(IListManager).get(fqdn_listname)
if mlist is None:
if args.archives:
log(_('No such list: $fqdn_listname; '
diff --git a/src/mailman/commands/cli_members.py b/src/mailman/commands/cli_members.py
index 5a2a419f7..d818d2853 100644
--- a/src/mailman/commands/cli_members.py
+++ b/src/mailman/commands/cli_members.py
@@ -29,6 +29,7 @@ import sys
import codecs
from email.utils import parseaddr
+from zope.component import getUtility
from zope.interface import implements
from mailman.app.membership import add_member
@@ -68,7 +69,7 @@ class Members:
assert len(args.listname) == 1, (
'Unexpected positional arguments: %s' % args.listname)
fqdn_listname = args.listname[0]
- mlist = IListManager(config).get(fqdn_listname)
+ mlist = getUtility(IListManager).get(fqdn_listname)
if mlist is None:
self.parser.error(_('No such list: $fqdn_listname'))
if args.filename == '-':
diff --git a/src/mailman/commands/docs/create.txt b/src/mailman/commands/docs/create.txt
index 349714a67..cf1557210 100644
--- a/src/mailman/commands/docs/create.txt
+++ b/src/mailman/commands/docs/create.txt
@@ -37,7 +37,8 @@ the mailing list and domain will be created.
Now both the domain and the mailing list exist in the database.
>>> from mailman.interfaces.listmanager import IListManager
- >>> list_manager = IListManager(config)
+ >>> from zope.component import getUtility
+ >>> list_manager = getUtility(IListManager)
>>> list_manager.get('test@example.xx')
<mailing list "test@example.xx" at ...>
diff --git a/src/mailman/commands/docs/remove.txt b/src/mailman/commands/docs/remove.txt
index 667b5d8c1..3f5c59bf4 100644
--- a/src/mailman/commands/docs/remove.txt
+++ b/src/mailman/commands/docs/remove.txt
@@ -9,7 +9,8 @@ A system administrator can remove mailing lists by the command line.
<mailing list "test@example.com" at ...>
>>> from mailman.interfaces.listmanager import IListManager
- >>> list_manager = IListManager(config)
+ >>> from zope.component import getUtility
+ >>> list_manager = getUtility(IListManager)
>>> list_manager.get('test@example.com')
<mailing list "test@example.com" at ...>