mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
[1.2.X] Fixed #12735 and #14892 -- Fixed support for the latest IPython (development) version in the shell management command.
Backport from trunk (r14895). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4803410721
commit
2ab1e92854
@ -23,11 +23,21 @@ class Command(NoArgsCommand):
|
|||||||
if use_plain:
|
if use_plain:
|
||||||
# Don't bother loading IPython, because the user wants plain Python.
|
# Don't bother loading IPython, because the user wants plain Python.
|
||||||
raise ImportError
|
raise ImportError
|
||||||
import IPython
|
try:
|
||||||
# Explicitly pass an empty list as arguments, because otherwise IPython
|
from IPython.frontend.terminal.embed import TerminalInteractiveShell
|
||||||
# would use sys.argv from this script.
|
shell = TerminalInteractiveShell()
|
||||||
shell = IPython.Shell.IPShell(argv=[])
|
shell.mainloop()
|
||||||
shell.mainloop()
|
except ImportError:
|
||||||
|
# IPython < 0.11
|
||||||
|
# Explicitly pass an empty list as arguments, because otherwise
|
||||||
|
# IPython would use sys.argv from this script.
|
||||||
|
try:
|
||||||
|
from IPython.Shell import IPShell
|
||||||
|
shell = IPShell(argv=[])
|
||||||
|
shell.mainloop()
|
||||||
|
except ImportError:
|
||||||
|
# IPython not found at all, raise ImportError
|
||||||
|
raise
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import code
|
import code
|
||||||
# Set up a dictionary to serve as the environment for the shell, so
|
# Set up a dictionary to serve as the environment for the shell, so
|
||||||
|
Loading…
x
Reference in New Issue
Block a user