[CalendarServer-changes] [9033] CalendarServer/trunk/calendarserver/tools/shell

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 11 15:23:20 PDT 2012


Revision: 9033
          http://trac.macosforge.org/projects/calendarserver/changeset/9033
Author:   wsanchez at apple.com
Date:     2012-04-11 15:23:20 -0700 (Wed, 11 Apr 2012)
Log Message:
-----------
Add raise command.

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

Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-11 22:15:31 UTC (rev 9032)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-11 22:23:20 UTC (rev 9033)
@@ -290,7 +290,7 @@
 
         # FIXME: Need to update key registrations
 
-    cmd_emulate.hidden = "Incomplete"
+    cmd_emulate.hidden = "incomplete"
 
     def complete_emulate(self, tokens):
         if len(tokens) == 0:
@@ -330,7 +330,7 @@
 
         self._logFile = fileName
 
-    cmd_log.hidden = "Debug tool"
+    cmd_log.hidden = "debug tool"
 
 
     #
@@ -447,6 +447,7 @@
     #
     # Principal tools
     #
+
     @inlineCallbacks
     def cmd_find_principals(self, tokens):
         """
@@ -563,7 +564,7 @@
         self.protocol.lineReceived = evalSomePython
         self.protocol.ps = (">>> ", "... ")
 
-    cmd_python.hidden = "Still experimental / untested."
+    cmd_python.hidden = "debug tool"
 
 
     #
@@ -581,4 +582,14 @@
 
         raise NotImplementedError("")
 
-    cmd_sql.hidden = "Not implemented."
+    cmd_sql.hidden = "not implemented"
+
+
+    #
+    # Test tools
+    #
+
+    def cmd_raise(self, tokens):
+        raise RuntimeError(" ".join(tokens))
+
+    cmd_raise.hidden = "test tool"

Modified: CalendarServer/trunk/calendarserver/tools/shell/terminal.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/terminal.py	2012-04-11 22:15:31 UTC (rev 9032)
+++ CalendarServer/trunk/calendarserver/tools/shell/terminal.py	2012-04-11 22:23:20 UTC (rev 9033)
@@ -157,6 +157,18 @@
             self.keyHandlers['\x01'] = self.handle_HOME   # Control-A
             self.keyHandlers['\x05'] = self.handle_END    # Control-E
 
+        def observer(event):
+            if not event["isError"]:
+                return
+
+            text = log.textFromEventDict(event)
+            if text is None:
+                return
+
+            self.service.reactor.callFromThread(self.terminal.write, text)
+
+        log.startLoggingWithObserver(observer)
+
     def handle_INT(self):
         """
         Handle ^C as an interrupt keystroke by resetting the current input
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120411/91530b08/attachment-0001.html>


More information about the calendarserver-changes mailing list