[Checkins] SVN: zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py rework the command to take advantage of the (experimental) zc.monitor

Benji York benji at zope.com
Tue Oct 27 17:18:51 EDT 2009


Log message for revision 105318:
  rework the command to take advantage of the (experimental) zc.monitor
  "MORE" mode
  

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-27 20:26:14 UTC (rev 105317)
+++ zc.monitorpdb/trunk/src/zc/monitorpdb/__init__.py	2009-10-27 21:18:51 UTC (rev 105318)
@@ -14,6 +14,7 @@
 
 import pdb
 import sys
+import zc.monitor
 
 class FakeStdout(object):
     def __init__(self, connection):
@@ -29,13 +30,25 @@
 debugger = fakeout = None
 
 
-def command(lines, *args):
+def command(connection, *args):
     global debugger
     global fakeout
+
+    if args and args[0] == 'debug':
+        connection.write('the "debug" command is not supported\n')
+
+    if args and args[0] == 'quit':
+        debugger = fakeout = None
+        return zc.monitor.QUIT_MARKER
+
+    # if we haven't set up a debugger yet, do so
     if debugger is None:
-        fakeout = FakeStdout(lines.connection)
+        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