[Zodb-checkins] SVN: zdaemon/trunk/src/zdaemon/ Provide doc strings for these two base classes.

Chris Withers chris at simplistix.co.uk
Fri Apr 10 05:50:13 EDT 2009


Log message for revision 99071:
  Provide doc strings for these two base classes.

Changed:
  U   zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
  U   zdaemon/trunk/src/zdaemon/zdoptions.py

-=-
Modified: zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdoptions.py	2009-04-10 09:35:06 UTC (rev 99070)
+++ zdaemon/trunk/src/zdaemon/tests/testzdoptions.py	2009-04-10 09:50:13 UTC (rev 99071)
@@ -104,9 +104,17 @@
             self.assertEqual(helptext, expected)
         
     def test_default_help(self):
+        # test what happens if OptionsClass is used directly.
+        # Not sure this ever happens :-S
+        self.help_test_helper(self.OptionsClass,{},self.OptionsClass.__doc__ or 'No help available.')
+
+    def test_default_subclass_help(self):
         # test what happens when the subclass doesn't do anything
         # with __doc__
-        self.help_test_helper(self.OptionsClass,{},'No help available.')
+        class SubClass(self.OptionsClass):
+            pass
+        # __doc__ isn't inherited :-( 
+        self.help_test_helper(SubClass,{},'No help available.')
 
     def test_default_help_with_doc_kw(self):
         # test what happens when the subclass doesn't do anything

Modified: zdaemon/trunk/src/zdaemon/zdoptions.py
===================================================================
--- zdaemon/trunk/src/zdaemon/zdoptions.py	2009-04-10 09:35:06 UTC (rev 99070)
+++ zdaemon/trunk/src/zdaemon/zdoptions.py	2009-04-10 09:50:13 UTC (rev 99071)
@@ -21,7 +21,21 @@
 import ZConfig
 
 class ZDOptions:
+    """a zdaemon script.
 
+    Usage: python <script>.py [-C URL] [zdrun-options] [action [arguments]]
+
+    Options:
+    -C/--configure URL -- configuration file or URL
+    -h/--help -- print usage message and exit
+
+    Actions are commands like "start", "stop" and "status".  If -i is
+    specified or no action is specified on the command line, a "shell"
+    interpreting actions typed interactively is started (unless the
+    configuration option default_to_interactive is set to false).  Use the
+    action "help" to find out about available actions.
+    """
+    
     doc = None
     progname = None
     configfile = None
@@ -341,7 +355,31 @@
 
 
 class RunnerOptions(ZDOptions):
+    """a zdaemon runner.
 
+    Usage: python <script>.py [-C URL][-h] [zdrun-options] [action [arguments]]
+
+    Options:
+    -C/--configure URL -- configuration file or URL
+    -h/--help -- print usage message and exit
+    -b/--backoff-limit SECONDS -- set backoff limit to SECONDS (default 10)
+    -d/--daemon -- run as a proper daemon; fork a subprocess, close files etc.
+    -f/--forever -- run forever (by default, exit when backoff limit is exceeded)
+    -h/--help -- print this usage message and exit
+    -s/--socket-name SOCKET -- Unix socket name for client (default "zdsock")
+    -u/--user USER -- run as this user (or numeric uid)
+    -m/--umask UMASK -- use this umask for daemon subprocess (default is 022)
+    -x/--exit-codes LIST -- list of fatal exit codes (default "0,2")
+    -z/--directory DIRECTORY -- directory to chdir to when using -d (default off)
+    action [arguments] -- see below
+
+    Actions are commands like "start", "stop" and "status".  If -i is
+    specified or no action is specified on the command line, a "shell"
+    interpreting actions typed interactively is started (unless the
+    configuration option default_to_interactive is set to false).  Use the
+    action "help" to find out about available actions.
+    """
+
     uid = gid = None
 
     def __init__(self):



More information about the Zodb-checkins mailing list