From 485e7ca368c4cf5b09cfbe89144ab3de8a3de4e3 2006-10-28 08:36:10
From: vivainio
Date: 2006-10-28 08:36:10
Subject: [PATCH] pydb_ipy.py extension adds %pydb magic when imported

---

diff --git a/IPython/Extensions/pydb_ipy.py b/IPython/Extensions/pydb_ipy.py
new file mode 100755
index 0000000..38f57b5
--- /dev/null
+++ b/IPython/Extensions/pydb_ipy.py
@@ -0,0 +1,22 @@
+import pydb
+import IPython.ipapi
+from IPython.genutils import arg_split
+ip = IPython.ipapi.get()
+
+def call_pydb(self, args):
+    argl = arg_split(args)
+    print argl
+    if ip.IP.has_readline:
+        ip.IP.savehist()
+    try:
+        pydb.runl(*args)
+    finally:
+    
+        if ip.IP.has_readline:
+            ip.IP.readline.read_history_file(self.shell.histfile)
+    
+ip.expose_magic("pydb",call_pydb)    
+
+    
+    
+    
\ No newline at end of file
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1d71498..a49620e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -4,6 +4,9 @@
 	file around %run commands to prevent side effects from 
 	%runned programs that might use readline (e.g. pydb).
 
+	* extensions/pydb_ipy.py: Adds %pydb magic when imported, for 
+	invoking the pydb enhanced debugger.
+
 2006-10-23  Walter Doerwald  <walter@livinglogic.de>
 
 	* IPython/Extensions/ipipe.py (ifile): Remove all methods that