summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/MailList.py13
-rw-r--r--Mailman/bin/show_config.py (renamed from Mailman/bin/show_mm_cfg.py)23
-rw-r--r--bin/Makefile.in2
3 files changed, 27 insertions, 11 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 9172bd7f3..575c9cc84 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -98,7 +98,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
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 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
#
# 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 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
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
diff --git a/Mailman/bin/show_mm_cfg.py b/Mailman/bin/show_config.py
index f9acb000c..ee97b16a8 100644
--- a/Mailman/bin/show_mm_cfg.py
+++ b/Mailman/bin/show_config.py
@@ -20,27 +20,34 @@ import sys
import pprint
import optparse
-from Mailman import mm_cfg
+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=mm_cfg.MAILMAN_VERSION,
+ parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
usage=_("""\
%%prog [options] [pattern ...]
-Show the values of various Defaults.py/mm_cfg.py variables.
+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 mm_cfg names, not just 'settings'."))
+ 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
@@ -58,9 +65,12 @@ def main():
patterns.append(re.compile(pattern, flag))
pp = pprint.PrettyPrinter(indent=4)
- names = mm_cfg.__dict__.keys()
+ 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
@@ -72,7 +82,7 @@ def main():
break
if not hit:
continue
- value = mm_cfg.__dict__[name]
+ value = config.__dict__[name]
if isinstance(value, str):
if re.search('\n', value):
print '%s = """%s"""' %(name, value)
@@ -86,3 +96,4 @@ def main():
if __name__ == '__main__':
main()
+
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 2256cfd60..a9b9c6688 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -56,7 +56,7 @@ SCRIPTS= mmshell \
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