[Zope-Checkins] CVS: Zope/lib/python/Controller - makeconfigfile.py:1.1.2.3

Chris McDonough chrism@zope.com
Mon, 2 Sep 2002 14:38:47 -0400


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

Modified Files:
      Tag: chrism-install-branch
	makeconfigfile.py 
Log Message:
Fix the configfile generator to show prettier output.

Add a 'shell' command to zctl which allows you to do things like:
"!vi zope.conf" from within zctl.


=== Zope/lib/python/Controller/makeconfigfile.py 1.1.2.2 => 1.1.2.3 ===
--- Zope/lib/python/Controller/makeconfigfile.py:1.1.2.2	Mon Sep  2 03:35:09 2002
+++ Zope/lib/python/Controller/makeconfigfile.py	Mon Sep  2 14:38:46 2002
@@ -1,4 +1,14 @@
-header_text = ''
+header_text = """\
+###############################################################################
+# Welcome to Zope 2.
+###############################################################################
+#
+# This is the default Zope configuration file.  The default Zope configuration
+# file shows what the default configuration directives are, and show examples
+# for each directive.  To declare a directive, make sure that you add it
+# to a line that does not begin with '#'.
+#\
+"""
 from TextBlockFormatter import format
 
 def main():
@@ -12,21 +22,28 @@
         (category, name, desc, type, valtype, influences, meta_default,
          default, example) = [ x.strip() for x in stuff ]
         desc = format(desc, 70).split('\n')
+        meta_default = format(meta_default, 70).split('\n')
         print "# Directive: %s" % name
         print "#"
         print "# Description:"
         for line in desc:
             print "#     %s" % line
         print "#"
-        influence_desc = (type == 'env' and 'environment variable' or
-                          type == 'cmd' and 'command-line switch to z2.py')
-        print "# Influences: %s %s" % (influences, influence_desc)
+        if type == 'env' or type == 'env_switch':
+            print '# Influences: %s environment variable' % influences
+        else:
+            print '# Influences: zope.py configuration'
         print "#"
-        print "# Default: %s" % meta_default
+        if len(meta_default) == 1:
+            print "# Default: %s" % meta_default[0]
+        else:
+            print "# Default:"
+            print "#"
+            for line in meta_default:
+                print "#     %s" % line
         print "#"
         if example:
             print "# Example:\n#\n#    %s %s" % (name, example)
-            print "#"
         print
         print