Changeset - e44954828c9a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 7 years ago 2018-09-01 01:20:18
mads@kiilerich.com
ishell: only report 'Kallithea ishell requires the IPython Python package' when ipython import fails

Move everything but the actual ipython import outside the 'Kallithea ishell
requires the IPython Python package' "try".
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/paster_commands/ishell.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.paster_commands.ishell
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
interactive shell gearbox command for Kallithea
 

	
 
This file was forked by the Kallithea project in July 2014.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: Apr 4, 2013
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 

	
 
import sys
 

	
 
# imports, used in IPython shell
 
import time
 
import shutil
 
import datetime
 
from kallithea.model.db import *
 

	
 
from kallithea.lib.paster_commands.common import BasePasterCommand
 

	
 

	
 
class Command(BasePasterCommand):
 
    "Kallithea: Interactive Python shell"
 

	
 
    def take_action(self, args):
 
        try:
 
            from IPython import embed
 
        except ImportError:
 
            print 'Kallithea ishell requires the IPython Python package'
 
            sys.exit(-1)
 
            from traitlets.config.loader import Config
 
            cfg = Config()
 
            cfg.InteractiveShellEmbed.confirm_exit = False
 
            embed(config=cfg, banner1="Kallithea IShell.")
 
        except ImportError:
 
            print 'Kallithea ishell requires the IPython Python package'
 
            sys.exit(-1)
0 comments (0 inline, 0 general)