CHANGES.txt | ●●●●● patch | view | raw | blame | history | |
repoze/bfg/paster.py | ●●●●● patch | view | raw | blame | history | |
repoze/bfg/tests/test_paster.py | ●●●●● patch | view | raw | blame | history |
CHANGES.txt
@@ -17,6 +17,9 @@ Bug Fixes --------- - Defer conditional import of IPython to avoid breakage under mod_wsgi. http://bugs.repoze.org/issue138 - More correct conversion of provided ``renderer`` values to resource specification values (internal). repoze/bfg/paster.py
@@ -9,11 +9,6 @@ from repoze.bfg.scripting import get_root try: from IPython.Shell import IPShell # pragma: no cover except ImportError: IPShell = None # pragma: no cover class StarterProjectTemplate(Template): _template_dir = 'paster_templates/starter' @@ -43,6 +38,7 @@ app = loadapp(config_name, name=name, relative_to=here_dir) return app _marker = object() class BFGShellCommand(Command): """Open an interactive shell with a :mod:`repoze.bfg` app loaded. @@ -78,7 +74,6 @@ interact = (interact,) # for testing loadapp = (loadapp,) # for testing IPShell = IPShell # for testing verbose = 3 def __init__(self, *arg, **kw): @@ -87,7 +82,12 @@ self.usage = '\n' + self.__doc__ Command.__init__(self, *arg, **kw) def command(self): def command(self, IPShell=_marker): if IPShell is _marker: try: #pragma no cover from IPython.Shell import IPShell except ImportError: #pragma no cover IPShell = None cprt =('Type "help" for more information. "root" is the BFG app ' 'root object.') banner = "Python %s on %s\n%s" % (sys.version, sys.platform, cprt) @@ -95,9 +95,9 @@ self.logging_file_config(config_file) app = get_app(config_file, section_name, loadapp=self.loadapp[0]) root, closer = get_root(app) if self.IPShell is not None and not self.options.disable_ipython: if IPShell is not None and not self.options.disable_ipython: try: shell = self.IPShell(argv=[], user_ns={'root':root}) shell = IPShell(argv=[], user_ns={'root':root}) shell.IP.BANNER = shell.IP.BANNER + '\n\n' + banner shell.mainloop() finally: @@ -107,5 +107,3 @@ self.interact[0](banner, local={'root':root}) finally: closer() repoze/bfg/tests/test_paster.py
@@ -20,7 +20,7 @@ class Options(object): pass command.options = Options() command.options.disable_ipython =True command.command() command.command(IPShell=None) self.assertEqual(loadapp.config_name, 'config:/foo/bar/myapp.ini') self.assertEqual(loadapp.section_name, 'myapp') self.failUnless(loadapp.relative_to) @@ -38,12 +38,11 @@ loadapp = DummyLoadApp(app) command.loadapp = (loadapp,) dummy_shell_factory = DummyIPShellFactory() command.IPShell = dummy_shell_factory command.args = ('/foo/bar/myapp.ini', 'myapp') class Options(object): pass command.options = Options() command.options.disable_ipython = False command.command() command.command(IPShell=dummy_shell_factory) self.assertEqual(loadapp.config_name, 'config:/foo/bar/myapp.ini') self.assertEqual(loadapp.section_name, 'myapp') self.failUnless(loadapp.relative_to)