diff options
author | Brandon Invergo <brandon@invergo.net> | 2013-05-19 13:23:17 +0200 |
---|---|---|
committer | Brandon Invergo <brandon@invergo.net> | 2013-05-19 13:23:17 +0200 |
commit | e02b7b6b3bd6b20c65aeb2ca5fd1e0030b631b88 (patch) | |
tree | 988b9505a649f824f2ea53ac04bdfbc3a0da983a /mediagoblin/gmg_commands/shell.py | |
parent | 60c42337ef7bc9b4aec0d3f1b2cb5f19a09d9a7f (diff) | |
parent | 041d2fd785f9b3e18f9fd758f91dbfa7715d317c (diff) | |
download | mediagoblin-e02b7b6b3bd6b20c65aeb2ca5fd1e0030b631b88.tar.lz mediagoblin-e02b7b6b3bd6b20c65aeb2ca5fd1e0030b631b88.tar.xz mediagoblin-e02b7b6b3bd6b20c65aeb2ca5fd1e0030b631b88.zip |
Merge branch 'master' of git://gitorious.org/mediagoblin/mediagoblin
Diffstat (limited to 'mediagoblin/gmg_commands/shell.py')
-rw-r--r-- | mediagoblin/gmg_commands/shell.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mediagoblin/gmg_commands/shell.py b/mediagoblin/gmg_commands/shell.py index ec1ab535..4998acd7 100644 --- a/mediagoblin/gmg_commands/shell.py +++ b/mediagoblin/gmg_commands/shell.py @@ -47,24 +47,21 @@ def py_shell(**user_namespace): def ipython_shell(**user_namespace): """ - Run a shell for the user using ipython. + Run a shell for the user using ipython. Return False if there is no IPython """ try: from IPython import embed except: - print "IPython not available... exiting!" - return - + return False + embed( banner1=SHELL_BANNER, user_ns=user_namespace) - + return True def shell(args): """ - Setup a shell for the user - either a normal Python shell - or an IPython one + Setup a shell for the user either a normal Python shell or an IPython one """ user_namespace = { 'mg_globals': mg_globals, @@ -74,4 +71,6 @@ def shell(args): if args.ipython: ipython_shell(**user_namespace) else: - py_shell(**user_namespace) + # Try ipython_shell first and fall back if not available + if not ipython_shell(**user_namespace): + py_shell(**user_namespace) |