[CalendarServer-changes] [7664] CalendarServer/trunk/calendarserver/tools/export.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 24 14:56:28 PDT 2011


Revision: 7664
          http://trac.macosforge.org/projects/calendarserver/changeset/7664
Author:   wsanchez at apple.com
Date:     2011-06-24 14:56:27 -0700 (Fri, 24 Jun 2011)
Log Message:
-----------
Handle UsageError

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

Modified: CalendarServer/trunk/calendarserver/tools/export.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/export.py	2011-06-24 21:42:13 UTC (rev 7663)
+++ CalendarServer/trunk/calendarserver/tools/export.py	2011-06-24 21:56:27 UTC (rev 7664)
@@ -39,7 +39,7 @@
 import itertools
 
 from twisted.python.text import wordWrap
-from twisted.python.usage import Options
+from twisted.python.usage import Options, UsageError
 from twisted.python import log
 from twisted.internet.defer import inlineCallbacks, returnValue
 
@@ -298,15 +298,22 @@
     """
     if reactor is None:
         from twisted.internet import reactor
+
     options = ExportOptions()
-    options.parseOptions(argv[1:])
     try:
+        options.parseOptions(argv[1:])
+    except UsageError, e:
+        usage(e)
+
+    try:
         output = options.openOutput()
     except IOError, e:
         stderr.write("Unable to open output file for writing: %s\n" %
                      (e))
         sys.exit(1)
+
     def makeService(store):
         from twistedcaldav.config import config
         return ExporterService(store, options, output, reactor, config)
-    utilityMain(options['config'], makeService, reactor)
+
+    utilityMain(options["config"], makeService, reactor)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110624/32090611/attachment-0001.html>


More information about the calendarserver-changes mailing list