[CalendarServer-changes] [12352] CalendarServer/branches/release/CalendarServer-5.2-dev/ calendarserver/tools/cmdline.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:16:18 PDT 2014
Revision: 12352
http://trac.calendarserver.org//changeset/12352
Author: sagen at apple.com
Date: 2014-01-15 14:21:35 -0800 (Wed, 15 Jan 2014)
Log Message:
-----------
By default, CLI tools quit right after doWork( ), but let each one override this behavior.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/cmdline.py
Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/cmdline.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/cmdline.py 2014-01-15 18:01:05 UTC (rev 12351)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/cmdline.py 2014-01-15 22:21:35 UTC (rev 12352)
@@ -35,6 +35,7 @@
# TODO: direct unit tests for these functions.
+
def utilityMain(configFileName, serviceClass, reactor=None, serviceMaker=CalDAVServiceMaker, patchConfig=None, onShutdown=None, verbose=False):
"""
Shared main-point for utilities.
@@ -139,7 +140,6 @@
@inlineCallbacks
def startService(self):
- from twisted.internet import reactor
try:
# Work can be queued but will not be performed by the command
# line tool
@@ -154,7 +154,7 @@
sys.stderr.write("Error: %s\n" % (e,))
raise
finally:
- reactor.stop()
+ self.postStartService()
def doWorkWithoutStore(self):
@@ -165,3 +165,12 @@
"""
sys.stderr.write("Error: Data store is not available\n")
return succeed(None)
+
+
+ def postStartService(self):
+ """
+ By default, stop the reactor after doWork( ) finishes. Subclasses
+ can override this if they want different behavior.
+ """
+ from twisted.internet import reactor
+ reactor.stop()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/9fb08a4b/attachment.html>
More information about the calendarserver-changes
mailing list