[Checkins] SVN: zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py checkpoint

Benji York benji at zope.com
Wed Oct 28 18:30:57 EDT 2009


Log message for revision 105346:
  checkpoint
  

Changed:
  U   zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py

-=-
Modified: zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py
===================================================================
--- zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py	2009-10-28 21:23:26 UTC (rev 105345)
+++ zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py	2009-10-28 22:30:57 UTC (rev 105346)
@@ -29,26 +29,34 @@
 
 debugger = fakeout = None
 
+def reset(connection):
+    global debugger
+    global fakeout
 
+    fakeout = FakeStdout(connection.connection)
+    debugger = pdb.Pdb(stdin=None, stdout=fakeout)
+    debugger.reset()
+    debugger.setup(sys._getframe(), None)
+
+
 def command(connection, *args):
     global debugger
     global fakeout
 
-    if args and args[0] == 'debug':
+    # if we haven't set up a debugger yet, do so
+    if debugger is None:
+        reset(connection)
+
+    # if the user wants us to rebuild the debugger, do it
+    if args and args[0] == 'reset':
+        reset(connection)
+    elif args and args[0] == 'debug':
         connection.write('the "debug" command is not supported\n')
-
-    if args and args[0] == 'quit':
+    elif args and args[0] == 'quit':
         debugger = fakeout = None
         return zc.monitor.QUIT_MARKER
+    else:
+        debugger.onecmd(' '.join(args))
 
-    # if we haven't set up a debugger yet, do so
-    if debugger is None:
-        fakeout = FakeStdout(connection.connection)
-        debugger = pdb.Pdb(stdin=None, stdout=fakeout)
-        debugger.reset()
-        debugger.setup(sys._getframe().f_back, None)
-
-    debugger.onecmd(' '.join(args))
-
     connection.write(debugger.prompt)
     return zc.monitor.MORE_MARKER



More information about the checkins mailing list