summaryrefslogtreecommitdiff
path: root/src/mailman/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/commands')
-rw-r--r--src/mailman/commands/cli_qfile.py2
-rw-r--r--src/mailman/commands/cli_withlist.py11
-rw-r--r--src/mailman/commands/docs/inject.rst54
-rw-r--r--src/mailman/commands/docs/withlist.rst19
4 files changed, 48 insertions, 38 deletions
diff --git a/src/mailman/commands/cli_qfile.py b/src/mailman/commands/cli_qfile.py
index 5851388de..78156f08c 100644
--- a/src/mailman/commands/cli_qfile.py
+++ b/src/mailman/commands/cli_qfile.py
@@ -31,8 +31,8 @@ from pprint import PrettyPrinter
from zope.interface import implements
from mailman.core.i18n import _
-from mailman.interact import interact
from mailman.interfaces.command import ICLISubCommand
+from mailman.utilities.interact import interact
m = []
diff --git a/src/mailman/commands/cli_withlist.py b/src/mailman/commands/cli_withlist.py
index dd1596227..3b1b36b1a 100644
--- a/src/mailman/commands/cli_withlist.py
+++ b/src/mailman/commands/cli_withlist.py
@@ -35,9 +35,9 @@ from zope.interface import implements
from mailman.config import config
from mailman.core.i18n import _
-from mailman.interact import DEFAULT_BANNER, interact
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
+from mailman.utilities.interact import DEFAULT_BANNER, interact
from mailman.utilities.modules import call_name
# Global holding onto the open mailing list.
@@ -151,7 +151,6 @@ class Withlist:
abort=config.db.abort,
config=config,
)
-
banner = config.shell.banner + '\n' + banner
if as_boolean(config.shell.use_ipython):
self._start_ipython(overrides, banner)
@@ -167,14 +166,14 @@ class Withlist:
print _('ipython is not available, set use_ipython to no')
def _start_python(self, overrides, banner):
- # set the tab completion
+ # Set the tab completion.
try:
import readline, rlcompleter
readline.parse_and_bind('tab: complete')
except ImportError:
pass
else:
- sys.ps1 = config.shell.ps1 + ' '
+ sys.ps1 = config.shell.prompt + ' '
interact(upframe=False, banner=banner, overrides=overrides)
def _details(self):
@@ -240,9 +239,9 @@ and run this from the command line:
% bin/mailman withlist -r change mylist@example.com 'My List'""")
-
+
class Shell(Withlist):
"""An alias for `withlist`."""
-
+
name = 'shell'
diff --git a/src/mailman/commands/docs/inject.rst b/src/mailman/commands/docs/inject.rst
index 1c0843ff3..7150beac7 100644
--- a/src/mailman/commands/docs/inject.rst
+++ b/src/mailman/commands/docs/inject.rst
@@ -35,7 +35,6 @@ It's easy to find out which queues are available.
digest
in
lmtp
- maildir
news
out
pipeline
@@ -55,6 +54,7 @@ Usually, the text of the message to inject is in a file.
... From: aperson@example.com
... To: test@example.com
... Subject: testing
+ ... Message-ID: <aardvark>
...
... This is a test message.
... """
@@ -70,22 +70,20 @@ Let's provide a list name and try again.
>>> mlist = create_list('test@example.com')
>>> transaction.commit()
+ >>> from mailman.testing.helpers import get_queue_messages
- >>> in_queue = config.switchboards['in']
- >>> len(in_queue.files)
- 0
+ >>> get_queue_messages('in')
+ []
>>> args.listname = ['test@example.com']
>>> command.process(args)
By default, the incoming queue is used.
::
- >>> len(in_queue.files)
+ >>> items = get_queue_messages('in')
+ >>> len(items)
1
-
- >>> from mailman.testing.helpers import get_queue_messages
- >>> item = get_queue_messages('in')[0]
- >>> print item.msg.as_string()
+ >>> print items[0].msg.as_string()
From: aperson@example.com
To: test@example.com
Subject: testing
@@ -96,10 +94,10 @@ By default, the incoming queue is used.
<BLANKLINE>
<BLANKLINE>
- >>> dump_msgdata(item.msgdata)
+ >>> dump_msgdata(items[0].msgdata)
_parsemsg : False
listname : test@example.com
- original_size: 90
+ original_size: 203
version : 3
But a different queue can be specified on the command line.
@@ -108,13 +106,12 @@ But a different queue can be specified on the command line.
>>> args.queue = 'virgin'
>>> command.process(args)
- >>> len(in_queue.files)
- 0
- >>> virgin_queue = config.switchboards['virgin']
- >>> len(virgin_queue.files)
+ >>> get_queue_messages('in')
+ []
+ >>> items = get_queue_messages('virgin')
+ >>> len(items)
1
- >>> item = get_queue_messages('virgin')[0]
- >>> print item.msg.as_string()
+ >>> print items[0].msg.as_string()
From: aperson@example.com
To: test@example.com
Subject: testing
@@ -125,10 +122,10 @@ But a different queue can be specified on the command line.
<BLANKLINE>
<BLANKLINE>
- >>> dump_msgdata(item.msgdata)
+ >>> dump_msgdata(items[0].msgdata)
_parsemsg : False
listname : test@example.com
- original_size: 90
+ original_size: 203
version : 3
@@ -145,6 +142,7 @@ The message text can also be provided on standard input.
... From: bperson@example.com
... To: test@example.com
... Subject: another test
+ ... Message-ID: <badger>
...
... This is another test message.
... """))
@@ -155,10 +153,10 @@ The message text can also be provided on standard input.
>>> args.queue = None
>>> command.process(args)
- >>> len(in_queue.files)
+ >>> items = get_queue_messages('in')
+ >>> len(items)
1
- >>> item = get_queue_messages('in')[0]
- >>> print item.msg.as_string()
+ >>> print items[0].msg.as_string()
From: bperson@example.com
To: test@example.com
Subject: another test
@@ -169,15 +167,15 @@ The message text can also be provided on standard input.
<BLANKLINE>
<BLANKLINE>
- >>> dump_msgdata(item.msgdata)
+ >>> dump_msgdata(items[0].msgdata)
_parsemsg : False
listname : test@example.com
- original_size: 100
+ original_size: 211
version : 3
- # Clean up.
- >>> sys.stdin = sys.__stdin__
- >>> args.filename = filename
+.. Clean up.
+ >>> sys.stdin = sys.__stdin__
+ >>> args.filename = filename
Metadata
@@ -200,7 +198,7 @@ injected.
bar : two
foo : one
listname : test@example.com
- original_size: 90
+ original_size: 203
version : 3
diff --git a/src/mailman/commands/docs/withlist.rst b/src/mailman/commands/docs/withlist.rst
index 7632c726a..f00208490 100644
--- a/src/mailman/commands/docs/withlist.rst
+++ b/src/mailman/commands/docs/withlist.rst
@@ -119,7 +119,20 @@ You also get an error if no mailing list is named.
--run requires a mailing list name
-Clean up
-========
+IPython
+=======
- >>> sys.path = old_path
+You can use `IPython`_ as the interactive shell by changing certain
+configuration variables in the `[shell]` section of your `mailman.cfg` file.
+Set `use_ipython` to "yes" to switch to IPython, which must be installed on
+your system.
+
+Other configuration variables in the `[shell]` section can be used to
+configure other aspects of the interactive shell. You can change both the
+prompt and the banner.
+
+
+.. Clean up
+ >>> sys.path = old_path
+
+.. _`IPython`: http://ipython.org/