Ticket #13554: ipython-0_10_and_0_11_support.patch

File ipython-0_10_and_0_11_support.patch, 1.2 KB (added by Jeff Kowalczyk, 14 years ago)

Patch to try IPython 0.11 API, fall back to 0.10 API otherwise.

  • django/core/management/commands/shell.py

    diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py
    index 9616902..0f6bd71 100644
    a b class Command(NoArgsCommand):  
    2424                # Don't bother loading IPython, because the user wants plain Python.
    2525                raise ImportError
    2626            import IPython
    27             # Explicitly pass an empty list as arguments, because otherwise IPython
    28             # would use sys.argv from this script.
    29             shell = IPython.Shell.IPShell(argv=[])
    30             shell.mainloop()
     27            try:
     28                from IPython.core.ipapp import IPythonApp
     29                # Explicitly pass an empty list as arguments, because otherwise
     30                # IPython would use sys.argv from this script.
     31                app = IPythonApp(argv=[])
     32                app.start()
     33            except ImportError:
     34                # try IPython API < 0.11
     35                shell = IPython.Shell.IPShell(argv=[])
     36                shell.mainloop()
    3137        except ImportError:
    3238            import code
    3339            # Set up a dictionary to serve as the environment for the shell, so
Back to Top