diff options
| author | Andrea Crotti | 2012-03-13 00:46:31 +0000 |
|---|---|---|
| committer | Andrea Crotti | 2012-03-13 00:46:31 +0000 |
| commit | cb8ee7cd32917fe58a12d4ae767b167356f0a1f5 (patch) | |
| tree | 0d22be20c3b2a354cf2e46cfb3f75d03b000c6da /src/mailman/commands/cli_withlist.py | |
| parent | 3fe7d15a5c6e54cc0c201b10b9dd1329dffe2cd2 (diff) | |
| download | mailman-cb8ee7cd32917fe58a12d4ae767b167356f0a1f5.tar.gz mailman-cb8ee7cd32917fe58a12d4ae767b167356f0a1f5.tar.zst mailman-cb8ee7cd32917fe58a12d4ae767b167356f0a1f5.zip | |
Diffstat (limited to 'src/mailman/commands/cli_withlist.py')
| -rw-r--r-- | src/mailman/commands/cli_withlist.py | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/mailman/commands/cli_withlist.py b/src/mailman/commands/cli_withlist.py index 61e1bec7c..bc25363b1 100644 --- a/src/mailman/commands/cli_withlist.py +++ b/src/mailman/commands/cli_withlist.py @@ -28,6 +28,8 @@ __all__ = [ import re +from lazr.config import as_boolean + from zope.component import getUtility from zope.interface import implements @@ -148,8 +150,34 @@ class Withlist: commit=config.db.commit, abort=config.db.abort, config=config, - ) - interact(upframe=False, banner=banner, overrides=overrides) + ) + banner = '\n'.join([unicode(config.shell.banner), banner]) + if as_boolean(config.shell.use_ipython): + self._start_ipython(overrides, banner) #config.shell.banner) + else: + self._start_python(overrides, banner) #config.shell.banner) + + def _start_ipython(self, overrides, banner): + try: + from IPython.frontend.terminal.embed import InteractiveShellEmbed + ipshell = InteractiveShellEmbed(banner1=banner, + user_ns=overrides) + ipshell() + except ImportError: + print _("ipython is not available, set use_ipython to no") + + def _start_python(self, overrides, banner): + # set the tab completion + import sys + try: + import readline, rlcompleter + readline.parse_and_bind('tab: complete') + except ImportError: + pass + else: + sys.ps1 = config.shell.ps1 + ' ' + interact(upframe=False, banner=config.shell.banner, + overrides=overrides) def _details(self): """Print detailed usage.""" |
