From c793f910ba4055d84cd4cff536a8b58c2f07d87f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 2 Nov 2009 16:40:30 +0000 Subject: - Compound statements that used an assignment entered into in an interactive IPython session invoked via ``paster bfgshell`` no longer fail to mutate the shell namespace correctly. For example, this set of statements used to fail:: In [2]: def bar(x): return x ...: In [3]: list(bar(x) for x in 'abc') Out[3]: NameError: 'bar' In this release, the ``bar`` function is found and the correct output is now sent to the console. Thanks to Daniel Holth for the patch. --- repoze/bfg/paster.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'repoze/bfg/paster.py') diff --git a/repoze/bfg/paster.py b/repoze/bfg/paster.py index de5dc1f79..e57d17c1b 100644 --- a/repoze/bfg/paster.py +++ b/repoze/bfg/paster.py @@ -10,9 +10,9 @@ from paste.util.template import paste_script_template_renderer from repoze.bfg.scripting import get_root try: - from IPython.Shell import IPShellEmbed + from IPython.Shell import IPShell except ImportError: - IPShellEmbed = None + IPShell = None class StarterProjectTemplate(Template): @@ -79,7 +79,7 @@ class BFGShellCommand(Command): interact = (interact,) # for testing loadapp = (loadapp,) # for testing - IPShellEmbed = IPShellEmbed # for testing + IPShell = IPShell # for testing verbose = 3 def command(self): @@ -89,11 +89,11 @@ class BFGShellCommand(Command): config_file, section_name = self.args app = get_app(config_file, section_name, loadapp=self.loadapp[0]) root, closer = get_root(app) - if self.IPShellEmbed is not None and not self.options.disable_ipython: - shell = self.IPShellEmbed(argv=self.args) - shell.set_banner(shell.IP.BANNER + '\n\n' + banner) + if self.IPShell is not None and not self.options.disable_ipython: try: - shell(local_ns={'root':root}, global_ns={}) + shell = self.IPShell(argv=[], user_ns={'root':root}) + shell.IP.BANNER = shell.IP.BANNER + '\n\n' + banner + shell.mainloop() finally: closer() else: -- cgit v1.2.3