[CalendarServer-changes] [7668] CalendarServer/trunk/calendarserver/tools/shell.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 24 16:52:33 PDT 2011


Revision: 7668
          http://trac.macosforge.org/projects/calendarserver/changeset/7668
Author:   wsanchez at apple.com
Date:     2011-06-24 16:52:33 -0700 (Fri, 24 Jun 2011)
Log Message:
-----------
Set up shell with manhole as a stub

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/shell.py

Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py	2011-06-24 23:26:52 UTC (rev 7667)
+++ CalendarServer/trunk/calendarserver/tools/shell.py	2011-06-24 23:52:33 UTC (rev 7668)
@@ -23,8 +23,10 @@
 import os
 import sys
 
+from twisted.python import log
 from twisted.python.text import wordWrap
 from twisted.python.usage import Options, UsageError
+from twisted.conch.stdio import runWithProtocol as shellWithProtocol, ConsoleManhole
 from twisted.application.service import Service
 
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
@@ -67,7 +69,7 @@
         super(ShellOptions, self).__init__()
 
 
-class ShellService(Service):
+class ShellService(Service, object):
     def __init__(self, store, options, reactor, config):
         super(ShellService, self).__init__()
         self.store   = store
@@ -80,20 +82,21 @@
         Start the service.
         """
         super(ShellService, self).startService()
-        self.shell()
+        shellWithProtocol(ShellProtocol)
+        self.reactor.stop()
 
     def stopService(self):
         """
         Stop the service.
         """
 
-    def shell(self):
-        """
-        Interactive shell
-        """
-        print "This is a shell, yo."
 
+class ShellProtocol(ConsoleManhole):
+    """
+    Data store shell protocol.
+    """
 
+
 def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
     """
     Do the export.
@@ -111,4 +114,6 @@
         from twistedcaldav.config import config
         return ShellService(store, options, reactor, config)
 
+    print "Initializing shell..."
+
     utilityMain(options["config"], makeService, reactor)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110624/d76bb08f/attachment-0001.html>


More information about the calendarserver-changes mailing list