summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2011-07-24 18:54:22 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2011-07-24 19:01:01 +0200
commit282a62fc3e943a416e22575d8dc9381f2077f273 (patch)
treee89d273f7565fc0f8db0e88e3ac8d62035f80b56
parentb210666d36ef855df45478526d3ed54196955a00 (diff)
downloadpyramid-282a62fc3e943a416e22575d8dc9381f2077f273.tar.gz
pyramid-282a62fc3e943a416e22575d8dc9381f2077f273.tar.bz2
pyramid-282a62fc3e943a416e22575d8dc9381f2077f273.zip
add compatibility with ipython 0.11
try to use 0.11 and 0.10 api to open embedded ipython shell
-rw-r--r--pyramid/paster.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/pyramid/paster.py b/pyramid/paster.py
index 3aa6a5f1d..8eb8f2413 100644
--- a/pyramid/paster.py
+++ b/pyramid/paster.py
@@ -150,11 +150,6 @@ class PShellCommand(PCommand):
def command(self, IPShell=_marker):
# IPShell passed to command method is for testing purposes
- if IPShell is _marker: # pragma: no cover
- try:
- from IPython.Shell import IPShell
- except ImportError:
- IPShell = None
config_uri = self.args[0]
config_file = config_uri.split('#', 1)[0]
self.logging_file_config(config_file)
@@ -197,6 +192,18 @@ class PShellCommand(PCommand):
help += '\n'
+ if IPShell is _marker:
+ try: #pragma no cover
+ try: #pragma no cover
+ from IPython.frontend.terminal.embed import InteractiveShellEmbed
+ IPShell = InteractiveShellEmbed(banner2=help, user_ns=env)
+ except ImportError: #pragma no cover
+ from IPython.Shell import IPShellEmbed
+ IPShell = IPShellEmbed(argv=[], user_ns=env)
+ IPShell.IP.BANNER = IPShell.IP.BANNER + '\n\n' + help
+ except ImportError: #pragma no cover
+ IPShell = None
+
if (IPShell is None) or self.options.disable_ipython:
cprt = 'Type "help" for more information.'
banner = "Python %s on %s\n%s" % (sys.version, sys.platform, cprt)
@@ -207,9 +214,7 @@ class PShellCommand(PCommand):
closer()
else:
try:
- shell = IPShell(argv=[], user_ns=env)
- shell.IP.BANNER = shell.IP.BANNER + help
- shell.mainloop()
+ IPShell()
finally:
closer()