Revision: 8057
          http://svn.sourceforge.net/mailman/?rev=8057&view=rev
Author:   msapiro
Date:     2006-10-11 17:49:48 -0700 (Wed, 11 Oct 2006)

Log Message:
-----------
- bin/show_mm_cfg.py renamed to bin/show_config.py.
- added a -C/--config option to bin/show_config.py and made a few
  other changes.
- MailList.py - r8040 broke Mailman/bin/update.py situate_list.
  Fixed it with this change.

Modified Paths:
--------------
    trunk/mailman/Mailman/MailList.py
    trunk/mailman/bin/Makefile.in

Added Paths:
-----------
    trunk/mailman/Mailman/bin/show_config.py

Removed Paths:
-------------
    trunk/mailman/Mailman/bin/show_mm_cfg.py

Modified: trunk/mailman/Mailman/MailList.py
===================================================================
--- trunk/mailman/Mailman/MailList.py   2006-10-12 00:48:48 UTC (rev 8056)
+++ trunk/mailman/Mailman/MailList.py   2006-10-12 00:49:48 UTC (rev 8057)
@@ -98,7 +98,7 @@
             if hasattr(baseclass, '__init__'):
                 baseclass.__init__(self)
         # Initialize volatile attributes
-        self.InitTempVars(name)
+        self.InitTempVars(name, check_version)
         # Attach a membership adaptor instance.
         parts = config.MEMBER_ADAPTOR_CLASS.split(DOT)
         adaptor_class = parts.pop()
@@ -277,7 +277,7 @@
     #
     # Instance and subcomponent initialization
     #
-    def InitTempVars(self, name):
+    def InitTempVars(self, name, check_version=True):
         """Set transient variables of this and inherited classes."""
         # The timestamp is set whenever we load the state from disk.  If our
         # timestamp is newer than the modtime of the config.pck file, we don't
@@ -294,8 +294,13 @@
             else:
                 self._internal_name = name
                 self.host_name = config.DEFAULT_EMAIL_HOST
-                self._full_path = os.path.join(config.LIST_DATA_DIR,
-                                               name + '@' + self.host_name)
+                if check_version:
+                    self._full_path = os.path.join(config.LIST_DATA_DIR,
+                                                   name + '@' +
+                                                   self.host_name)
+                else:
+                    self._full_path = os.path.join(config.LIST_DATA_DIR,
+                                                   name)
         else:
             self._full_path = ''
         # Only one level of mixin inheritance allowed

Copied: trunk/mailman/Mailman/bin/show_config.py (from rev 8055, 
trunk/mailman/Mailman/bin/show_mm_cfg.py)
===================================================================
--- trunk/mailman/Mailman/bin/show_config.py                            (rev 0)
+++ trunk/mailman/Mailman/bin/show_config.py    2006-10-12 00:49:48 UTC (rev 
8057)
@@ -0,0 +1,99 @@
+# Copyright (C) 2006 by the Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import re
+import sys
+import pprint
+import optparse
+
+from Mailman import Version
+from Mailman.configuration import config
+from Mailman.i18n import _
+
+__i18_templates__ = True
+
+# List of names never to show even if --verbose
+NEVER_SHOW = ['__builtins__', '__doc__']
+
+
+
+def parseargs():
+    parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
+                                   usage=_("""\
+%%prog [options] [pattern ...]
+
+Show the values of various Defaults.py/mailman.cfg variables.
+If one or more patterns are given, show only those variables
+whose names match a pattern"""))
+    parser.add_option('-v', '--verbose',
+                      default=False, action='store_true',
+                      help=_(
+"Show all configuration names, not just 'settings'."))
+    parser.add_option('-i', '--ignorecase',
+                      default=False, action='store_true',
+                      help=_("Match patterns case-insensitively."))
+    parser.add_option('-C', '--config',
+                      help=_('Alternative configuration file to use'))
+    opts, args = parser.parse_args()
+    return parser, opts, args
+
+
+
+def main():
+    parser, opts, args = parseargs()
+
+    patterns = []
+    if opts.ignorecase:
+        flag = re.IGNORECASE
+    else:
+        flag = 0
+    for pattern in args:
+        patterns.append(re.compile(pattern, flag))
+
+    pp = pprint.PrettyPrinter(indent=4)
+    config.load(opts.config)
+    names = config.__dict__.keys()
+    names.sort()
+    for name in names:
+        if name in NEVER_SHOW:
+            continue
+        if not opts.verbose:
+            if name.startswith('_') or re.search('[a-z]', name):
+                continue
+        if patterns:
+            hit = False
+            for pattern in patterns:
+                if pattern.search(name):
+                    hit = True
+                    break
+            if not hit:
+                continue
+        value = config.__dict__[name]
+        if isinstance(value, str):
+            if re.search('\n', value):
+                print '%s = """%s"""' %(name, value)
+            else:
+                print "%s = '%s'" % (name, value)
+        else:
+            print '%s = ' % name,
+            pp.pprint(value)
+
+
+
+if __name__ == '__main__':
+    main()
+

Deleted: trunk/mailman/Mailman/bin/show_mm_cfg.py
===================================================================
--- trunk/mailman/Mailman/bin/show_mm_cfg.py    2006-10-12 00:48:48 UTC (rev 
8056)
+++ trunk/mailman/Mailman/bin/show_mm_cfg.py    2006-10-12 00:49:48 UTC (rev 
8057)
@@ -1,88 +0,0 @@
-# Copyright (C) 2006 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-import re
-import sys
-import pprint
-import optparse
-
-from Mailman import mm_cfg
-from Mailman.i18n import _
-
-__i18_templates__ = True
-
-
-
-def parseargs():
-    parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
-                                   usage=_("""\
-%%prog [options] [pattern ...]
-
-Show the values of various Defaults.py/mm_cfg.py variables.
-If one or more patterns are given, show only those variables
-whose names match a pattern"""))
-    parser.add_option('-v', '--verbose',
-                      default=False, action='store_true',
-                      help=_("Show all mm_cfg names, not just 'settings'."))
-    parser.add_option('-i', '--ignorecase',
-                      default=False, action='store_true',
-                      help=_("Match patterns case-insensitively."))
-    opts, args = parser.parse_args()
-    return parser, opts, args
-
-
-
-def main():
-    parser, opts, args = parseargs()
-
-    patterns = []
-    if opts.ignorecase:
-        flag = re.IGNORECASE
-    else:
-        flag = 0
-    for pattern in args:
-        patterns.append(re.compile(pattern, flag))
-
-    pp = pprint.PrettyPrinter(indent=4)
-    names = mm_cfg.__dict__.keys()
-    names.sort()
-    for name in names:
-        if not opts.verbose:
-            if name.startswith('_') or re.search('[a-z]', name):
-                continue
-        if patterns:
-            hit = False
-            for pattern in patterns:
-                if pattern.search(name):
-                    hit = True
-                    break
-            if not hit:
-                continue
-        value = mm_cfg.__dict__[name]
-        if isinstance(value, str):
-            if re.search('\n', value):
-                print '%s = """%s"""' %(name, value)
-            else:
-                print "%s = '%s'" % (name, value)
-        else:
-            print '%s = ' % name,
-            pp.pprint(value)
-
-
-
-if __name__ == '__main__':
-    main()

Modified: trunk/mailman/bin/Makefile.in
===================================================================
--- trunk/mailman/bin/Makefile.in       2006-10-12 00:48:48 UTC (rev 8056)
+++ trunk/mailman/bin/Makefile.in       2006-10-12 00:49:48 UTC (rev 8057)
@@ -56,7 +56,7 @@
 LN_SCRIPTS=    add_members arch change_pw check_perms config_list \
                export find_member genaliases inject list_lists \
                list_members list_owners mailmanctl mmsitepass newlist \
-               qrunner rmlist show_qfiles show_mm_cfg testall unshunt \
+               qrunner rmlist show_config show_qfiles testall unshunt \
                update version
 
 BUILDDIR=      ../build/bin


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to