Fixed #14187 -- Added support for bpython to shell management command. Thanks, Jeremy Dunck.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-12-12 23:03:24 +00:00
parent 47a5153da4
commit 05eb53603c
2 changed files with 9 additions and 4 deletions

View File

@ -8,7 +8,7 @@ class Command(NoArgsCommand):
help='Tells Django to use plain Python, not IPython.'), help='Tells Django to use plain Python, not IPython.'),
) )
help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
shells = ['ipython'] shells = ['ipython', 'bpython']
requires_model_validation = False requires_model_validation = False
def ipython(self): def ipython(self):
@ -28,6 +28,10 @@ class Command(NoArgsCommand):
# IPython not found at all, raise ImportError # IPython not found at all, raise ImportError
raise raise
def bpython(self):
import bpython
bpython.embed()
def run_shell(self): def run_shell(self):
for shell in self.shells: for shell in self.shells:
try: try:

View File

@ -747,13 +747,14 @@ shell
Starts the Python interactive interpreter. Starts the Python interactive interpreter.
Django will use IPython_, if it's installed. If you have IPython installed and Django will use IPython_ or bpython_ if either is installed. If you have a
want to force use of the "plain" Python interpreter, use the ``--plain`` rich shell installed but want to force use of the "plain" Python interpreter,
option, like so:: use the ``--plain`` option, like so::
django-admin.py shell --plain django-admin.py shell --plain
.. _IPython: http://ipython.scipy.org/ .. _IPython: http://ipython.scipy.org/
.. _bpython: http://bpython-interpreter.org/
sql <appname appname ...> sql <appname appname ...>
------------------------- -------------------------