[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - ZctlLib.py:1.1.2.6

Fred L. Drake, Jr. fred@zope.com
Fri, 24 Jan 2003 16:04:58 -0500


Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv956

Modified Files:
      Tag: chrism-install-branch
	ZctlLib.py 
Log Message:
- minor cleanup
- remove unused import
- normalize whitespace


=== Zope/lib/python/Zope/Startup/ZctlLib.py 1.1.2.5 => 1.1.2.6 ===
--- Zope/lib/python/Zope/Startup/ZctlLib.py:1.1.2.5	Tue Jan 14 22:39:05 2003
+++ Zope/lib/python/Zope/Startup/ZctlLib.py	Fri Jan 24 16:04:54 2003
@@ -7,7 +7,7 @@
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """
@@ -18,17 +18,18 @@
 
 __version__ = '$Revision$'[11:-2]
 
+import cmd
 import getopt
 import os
-import sys
-import re
 import signal
-import cmd
+import sys
 import time
+
 try:
     import readline
 except:
     readline = None
+
 from Zope.Startup import getOptions, getOptionDescriptions, configure
 from Zope.Startup.misc import TextBlockFormatter
 from Zope.Startup.misc.lock_file import lock_file
@@ -240,7 +241,7 @@
             Syntax: show [option]
 
             Options:
-            
+
               config        Combo of 'options', 'python', 'config-path' and
                             'command-line'
 
@@ -491,7 +492,7 @@
         self._report()
         self._report(' '.join(self._getCommandLineOpts()))
         self._report()
- 
+
     def lockFile(self):
         filename = self._getConfigValue('lock_filename')
         if not os.path.exists(filename):
@@ -503,12 +504,10 @@
             return 1
         return 0
 
-def normalizeDocstring( bound_method ):
-
-    doc = bound_method.__doc__
-    lines = doc.split( '\n' )
-    lines = [ line.strip() for line in lines ]
-    return '\n'.join( lines )
+def normalizeDocstring(obj):
+    """Remove leading and trailing whitespace from each line of a docstring."""
+    lines = [line.strip() for line in obj.__doc__.split('\n')]
+    return '\n'.join(lines)
 
 def _MAKEDO( command ):
     """
@@ -523,7 +522,7 @@
         getattr( self._engine, command )( args )
 
     xdo.func_doc = normalizeDocstring( getattr( ZopeCtl, command ) )
-        
+
     return xdo
 
 #
@@ -640,7 +639,7 @@
         meta = ['config', 'options', 'python', 'command-line',
                 'config-path']
         return [a for a in meta if a.startswith(text) ]
-    
+
     do_start          = _MAKEDO( 'start' )
     do_restart        = _MAKEDO( 'restart' )
     do_logopenclose   = _MAKEDO( 'logopenclose' )