incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1296929 - /incubator/tashi/trunk/src/tashi/util.py
Date Mon, 05 Mar 2012 01:30:16 GMT
Author: stroucki
Date: Mon Mar  5 01:30:15 2012
New Revision: 1296929

URL: http://svn.apache.org/viewvc?rev=1296929&view=rev
Log:
util.py: marvellous api changes of ipython. ensure we have correct namespace.

Modified:
    incubator/tashi/trunk/src/tashi/util.py

Modified: incubator/tashi/trunk/src/tashi/util.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/util.py?rev=1296929&r1=1296928&r2=1296929&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/util.py (original)
+++ incubator/tashi/trunk/src/tashi/util.py Mon Mar  5 01:30:15 2012
@@ -219,29 +219,29 @@ def getConfig(additionalNames=[], additi
 		raise Exception("No config file could be found: %s" % (str(allLocations)))
 	return (config, configFiles)
 
-def __getShellFn():
+def __getShellFn(globalDict):
 	if sys.version_info < (2, 6, 1):
 		from IPython.Shell import IPShellEmbed
-		return IPShellEmbed()
+		return IPShellEmbed(user_ns=globalDict)
 	else:
 		import IPython
-		return IPython.embed()
+		return IPython.embed(user_ns=globalDict)
 
 def debugConsole(globalDict):
 	"""A debugging console that optionally uses pysh"""
 	def realDebugConsole(globalDict):
 		try :
 			import atexit
-			shellfn = __getShellFn()
+			shellfn = __getShellFn(globalDict)
 			def resetConsole():
 # XXXpipe: make input window sane
 				(stdin, stdout) = os.popen2("reset")
 				stdout.read()
 			dbgshell = shellfn()
 			atexit.register(resetConsole)
-			dbgshell(local_ns=globalDict, global_ns=globalDict)
-		except Exception:
-			CONSOLE_TEXT=">>> "
+			dbgshell()
+		except Exception, e:
+			CONSOLE_TEXT="%s >>> " % (str(e))
 			input = " " 
 			while (input != ""):
 				sys.stdout.write(CONSOLE_TEXT)



Mime
View raw message