From cf6448420c10aaf4cd7a8af27058df852017cb7c Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Sat, 4 Nov 2006 21:05:32 +0000 Subject: Convert dumpdb to mmshell and configuration object. Convert htmlformat.py from mm_cfg to the configuration object. In the config object, add an add_runner() function for extending the QRUNNERS variable. De-DOS-line-ending-ify configuration.py --- Mailman/MailList.py | 5 +- Mailman/bin/dumpdb.py | 127 ++++++++++++++++++++ Mailman/bin/update.py | 2 +- Mailman/configuration.py | 299 ++++++++++++++++++++++++----------------------- Mailman/htmlformat.py | 55 ++++----- bin/Makefile.in | 4 +- bin/dumpdb | 137 ---------------------- bin/update | 0 configure | 3 +- configure.in | 3 +- 10 files changed, 315 insertions(+), 320 deletions(-) create mode 100644 Mailman/bin/dumpdb.py delete mode 100644 bin/dumpdb delete mode 100755 bin/update diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 7cac64865..245f16ad8 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -45,6 +45,7 @@ from email.Utils import getaddresses, formataddr, parseaddr from Mailman import Errors from Mailman import LockFile from Mailman import Utils +from Mailman import Version from Mailman.UserDesc import UserDesc from Mailman.configuration import config @@ -740,7 +741,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # def CheckVersion(self, stored_state): """Auto-update schema if necessary.""" - if self.data_version >= config.DATA_FILE_VERSION: + if self.data_version >= Version.DATA_FILE_VERSION: return # Initialize any new variables self.InitVars() @@ -755,7 +756,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, try: from versions import Update Update(self, stored_state) - self.data_version = config.DATA_FILE_VERSION + self.data_version = Version.DATA_FILE_VERSION self.Save() finally: if not waslocked: diff --git a/Mailman/bin/dumpdb.py b/Mailman/bin/dumpdb.py new file mode 100644 index 000000000..a8d0f89ea --- /dev/null +++ b/Mailman/bin/dumpdb.py @@ -0,0 +1,127 @@ +#! @PYTHON@ +# +# Copyright (C) 1998-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 sys +import pprint +import cPickle +import marshal +import optparse + +from Mailman import Version +from Mailman.configuration import config +from Mailman.i18n import _ + +__i18n_templates__ = True + +COMMASPACE = ', ' + + + +def parseargs(): + parser = optparse.OptionParser(version=Version.MAILMAN_VERSION, + usage=_("""\ +%%prog [options] filename + +Dump the contents of any Mailman `database' file. + +If the filename ends with `.db', then it is assumed that the file contains a +Python marshal. If the file ends with `.pck' then it is assumed to contain a +Python pickle. In either case, if you want to override the default assumption +-- or if the file ends in neither suffix -- use the -p or -m flags.""")) + parser.add_option('-m', '--marshal', + default=False, action='store_true', + help=_("""\ +Assume the file contains a Python marshal, +overridding any automatic guessing.""")) + parser.add_option('-p', '--pickle', + default=False, action='store_true', + help=_("""\ +Assume the file contains a Python pickle, +overridding any automatic guessing.""")) + parser.add_option('-n', '--noprint', + default=False, action='store_true', + help=_("""\ +Don't attempt to pretty print the object. This is useful if there's +some problem with the object and you just want to get an unpickled +representation. Useful with `python -i bin/dumpdb '. In that +case, the root of the tree will be left in a global called "msg".""")) + parser.add_option('-C', '--config', + help=_('Alternative configuration file to use')) + opts, args = parser.parse_args() + # Options. + # None == guess, 0 == pickle, 1 == marshal + opts.filetype = None + if opts.pickle: + opts.filetype = 0 + if opts.marshal: + opts.filetype = 1 + opts.doprint = not opts.noprint + if len(args) < 1: + parser.error(_('No filename given.')) + elif len(args) > 1: + pargs = COMMASPACE.join(args) + parser.error(_('Bad arguments: $pargs')) + else: + opts.filename = args[0] + if opts.filetype is None: + if opts.filename.endswith('.db'): + opts.filetype = 1 + elif opts.filename.endswith('.pck'): + opts.filetype = 0 + else: + parser.error(_('Please specify either -p or -m.')) + return parser, opts, args + + + +def main(): + parser, opts, args = parseargs() + config.load(opts.config) + + # Handle dbs + pp = pprint.PrettyPrinter(indent=4) + if opts.filetype == 1: + load = marshal.load + typename = 'marshal' + else: + load = cPickle.load + typename = 'pickle' + fp = open(opts.filename) + m = [] + try: + cnt = 1 + if opts.doprint: + print _('[----- start $typename file -----]') + while True: + try: + obj = load(fp) + except EOFError: + if opts.doprint: + print _('[----- end $typename file -----]') + break + if opts.doprint: + print _('<----- start object $cnt ----->') + if isinstance(obj, str): + print obj + else: + pp.pprint(obj) + cnt += 1 + m.append(obj) + finally: + fp.close() diff --git a/Mailman/bin/update.py b/Mailman/bin/update.py index 1577f0450..72a40ab8c 100644 --- a/Mailman/bin/update.py +++ b/Mailman/bin/update.py @@ -76,7 +76,7 @@ def calcversions(): # # See if we stored the last updated version lastversion = None - thisversion = config.HEX_VERSION + thisversion = Version.HEX_VERSION try: fp = open(os.path.join(config.DATA_DIR, 'last_mailman_version')) data = fp.read() diff --git a/Mailman/configuration.py b/Mailman/configuration.py index ebc42c218..bf2da60fc 100644 --- a/Mailman/configuration.py +++ b/Mailman/configuration.py @@ -1,144 +1,155 @@ -# 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. - -"""Configuration file loading and management.""" - -import os -import errno - -from Mailman import Defaults -from Mailman import Errors - -_missing = object() - - - -class Configuration(object): - def __init__(self): - self.domains = {} # email host -> web host - self._reverse = None - - def load(self, filename=None): - # Load the configuration from the named file, or if not given, search - # in VAR_PREFIX for an etc/mailman.cfg file. If that file is missing, - # use Mailman/mm_cfg.py for backward compatibility. - # - # Whatever you find, create a namespace and execfile that file in it. - # The values in that namespace are exposed as attributes on this - # Configuration instance. - original_filename = filename - if filename is None: - filename = os.path.join(Defaults.VAR_PREFIX, 'etc', 'mailman.cfg') - # Set up the execfile namespace - ns = Defaults.__dict__.copy() - # Prune a few things, add a few things - del ns['__file__'] - del ns['__name__'] - del ns['__doc__'] - ns['add_domain'] = self.add_domain - # Attempt our first choice - path = os.path.abspath(os.path.expanduser(filename)) - try: - execfile(path, ns, ns) - except EnvironmentError, e: - if e.errno <> errno.ENOENT or original_filename: - raise - # The file didn't exist, so try mm_cfg.py - from Mailman import mm_cfg - ns.update(mm_cfg.__dict__) - # Pull out the defaults - PREFIX = ns['PREFIX'] - VAR_PREFIX = ns['VAR_PREFIX'] - EXEC_PREFIX = ns['EXEC_PREFIX'] - # Now that we've loaded all the configuration files we're going to - # load, set up some useful directories. - self.LIST_DATA_DIR = os.path.join(VAR_PREFIX, 'lists') - self.LOG_DIR = os.path.join(VAR_PREFIX, 'logs') - self.LOCK_DIR = lockdir = os.path.join(VAR_PREFIX, 'locks') - self.DATA_DIR = datadir = os.path.join(VAR_PREFIX, 'data') - self.ETC_DIR = etcdir = os.path.join(VAR_PREFIX, 'etc') - self.SPAM_DIR = os.path.join(VAR_PREFIX, 'spam') - self.WRAPPER_DIR = os.path.join(EXEC_PREFIX, 'mail') - self.BIN_DIR = os.path.join(PREFIX, 'bin') - self.SCRIPTS_DIR = os.path.join(PREFIX, 'scripts') - self.TEMPLATE_DIR = os.path.join(PREFIX, 'templates') - self.MESSAGES_DIR = os.path.join(PREFIX, 'messages') - self.PUBLIC_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, - 'archives', 'public') - self.PRIVATE_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, - 'archives', 'private') - # Directories used by the qrunner subsystem - self.QUEUE_DIR = qdir = os.path.join(VAR_PREFIX, 'qfiles') - self.INQUEUE_DIR = os.path.join(qdir, 'in') - self.OUTQUEUE_DIR = os.path.join(qdir, 'out') - self.CMDQUEUE_DIR = os.path.join(qdir, 'commands') - self.BOUNCEQUEUE_DIR = os.path.join(qdir, 'bounces') - self.NEWSQUEUE_DIR = os.path.join(qdir, 'news') - self.ARCHQUEUE_DIR = os.path.join(qdir, 'archive') - self.SHUNTQUEUE_DIR = os.path.join(qdir, 'shunt') - self.VIRGINQUEUE_DIR = os.path.join(qdir, 'virgin') - self.BADQUEUE_DIR = os.path.join(qdir, 'bad') - self.RETRYQUEUE_DIR = os.path.join(qdir, 'retry') - self.MAILDIR_DIR = os.path.join(qdir, 'maildir') - # Other useful files - self.PIDFILE = os.path.join(datadir, - 'master-qrunner.pid') - self.SITE_PW_FILE = os.path.join(datadir, 'adm.pw') - self.LISTCREATOR_PW_FILE = os.path.join(datadir, 'creator.pw') - self.CONFIG_FILE = os.path.join(etcdir, 'mailman.cfg') - self.LOCK_FILE = os.path.join(lockdir, 'master-qrunner') - # Now update our dict so attribute syntax just works - if 'add_domain' in ns: - del ns['add_domain'] - self.__dict__.update(ns) - # Add the default domain if there are no virtual domains currently - # defined. - if not self.domains: - self.add_domain(self.DEFAULT_EMAIL_HOST, self.DEFAULT_URL_HOST) - - def add_domain(self, email_host, url_host): - """Add the definition of a virtual domain. - - email_host is the right-hand side of the posting email address, - e.g. 'example.com' in 'mylist@example.com'. url_host is the host name - part of the exposed web pages, e.g. 'www.example.com'.""" - if email_host in self.domains: - raise Errors.BadDomainSpecificationError( - 'Duplicate email host: %s' % email_host) - # Make sure there's only one mapping for the url_host - if url_host in self.domains.values(): - raise Errors.BadDomainSpecificationError( - 'Duplicate url host: %s' % url_host) - # We'll do the reverse mappings on-demand. There shouldn't be too - # many virtual hosts that it will really matter that much. - self.domains[email_host] = url_host - # Invalidate the reverse mapping cache - self._reverse = None - - # Given an email host name, the url host name can be looked up directly. - # This does the reverse mapping. - def get_email_host(self, url_host, default=None): - if self._reverse is None: - # XXX Can't use a generator comprehension until Python 2.4 is - # minimum requirement. - self._reverse = dict([(v, k) for k, v in self.domains.items()]) - return self._reverse.get(url_host, default) - - - -config = Configuration() - +# 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. + +"""Configuration file loading and management.""" + +import os +import errno + +from Mailman import Defaults +from Mailman import Errors + +_missing = object() + + + +class Configuration(object): + def __init__(self): + self.domains = {} # email host -> web host + self._reverse = None + + def load(self, filename=None): + # Load the configuration from the named file, or if not given, search + # in VAR_PREFIX for an etc/mailman.cfg file. If that file is missing, + # use Mailman/mm_cfg.py for backward compatibility. + # + # Whatever you find, create a namespace and execfile that file in it. + # The values in that namespace are exposed as attributes on this + # Configuration instance. + original_filename = filename + if filename is None: + filename = os.path.join(Defaults.VAR_PREFIX, 'etc', 'mailman.cfg') + # Set up the execfile namespace + ns = Defaults.__dict__.copy() + # Prune a few things, add a few things + del ns['__file__'] + del ns['__name__'] + del ns['__doc__'] + ns['add_domain'] = self.add_domain + ns['add_runner'] = self.add_runner + # Attempt our first choice + path = os.path.abspath(os.path.expanduser(filename)) + try: + execfile(path, ns, ns) + except EnvironmentError, e: + if e.errno <> errno.ENOENT or original_filename: + raise + # The file didn't exist, so try mm_cfg.py + from Mailman import mm_cfg + ns.update(mm_cfg.__dict__) + # Pull out the defaults + PREFIX = ns['PREFIX'] + VAR_PREFIX = ns['VAR_PREFIX'] + EXEC_PREFIX = ns['EXEC_PREFIX'] + # Now that we've loaded all the configuration files we're going to + # load, set up some useful directories. + self.LIST_DATA_DIR = os.path.join(VAR_PREFIX, 'lists') + self.LOG_DIR = os.path.join(VAR_PREFIX, 'logs') + self.LOCK_DIR = lockdir = os.path.join(VAR_PREFIX, 'locks') + self.DATA_DIR = datadir = os.path.join(VAR_PREFIX, 'data') + self.ETC_DIR = etcdir = os.path.join(VAR_PREFIX, 'etc') + self.SPAM_DIR = os.path.join(VAR_PREFIX, 'spam') + self.WRAPPER_DIR = os.path.join(EXEC_PREFIX, 'mail') + self.BIN_DIR = os.path.join(PREFIX, 'bin') + self.SCRIPTS_DIR = os.path.join(PREFIX, 'scripts') + self.TEMPLATE_DIR = os.path.join(PREFIX, 'templates') + self.MESSAGES_DIR = os.path.join(PREFIX, 'messages') + self.PUBLIC_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, + 'archives', 'public') + self.PRIVATE_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, + 'archives', 'private') + # Directories used by the qrunner subsystem + self.QUEUE_DIR = qdir = os.path.join(VAR_PREFIX, 'qfiles') + self.INQUEUE_DIR = os.path.join(qdir, 'in') + self.OUTQUEUE_DIR = os.path.join(qdir, 'out') + self.CMDQUEUE_DIR = os.path.join(qdir, 'commands') + self.BOUNCEQUEUE_DIR = os.path.join(qdir, 'bounces') + self.NEWSQUEUE_DIR = os.path.join(qdir, 'news') + self.ARCHQUEUE_DIR = os.path.join(qdir, 'archive') + self.SHUNTQUEUE_DIR = os.path.join(qdir, 'shunt') + self.VIRGINQUEUE_DIR = os.path.join(qdir, 'virgin') + self.BADQUEUE_DIR = os.path.join(qdir, 'bad') + self.RETRYQUEUE_DIR = os.path.join(qdir, 'retry') + self.MAILDIR_DIR = os.path.join(qdir, 'maildir') + # Other useful files + self.PIDFILE = os.path.join(datadir, + 'master-qrunner.pid') + self.SITE_PW_FILE = os.path.join(datadir, 'adm.pw') + self.LISTCREATOR_PW_FILE = os.path.join(datadir, 'creator.pw') + self.CONFIG_FILE = os.path.join(etcdir, 'mailman.cfg') + self.LOCK_FILE = os.path.join(lockdir, 'master-qrunner') + # Now update our dict so attribute syntax just works + if 'add_domain' in ns: + del ns['add_domain'] + if 'add_runner' in ns: + del ns['add_runner'] + self.__dict__.update(ns) + # Add the default domain if there are no virtual domains currently + # defined. + if not self.domains: + self.add_domain(self.DEFAULT_EMAIL_HOST, self.DEFAULT_URL_HOST) + + def add_domain(self, email_host, url_host): + """Add the definition of a virtual domain. + + email_host is the right-hand side of the posting email address, + e.g. 'example.com' in 'mylist@example.com'. url_host is the host name + part of the exposed web pages, e.g. 'www.example.com'.""" + if email_host in self.domains: + raise Errors.BadDomainSpecificationError( + 'Duplicate email host: %s' % email_host) + # Make sure there's only one mapping for the url_host + if url_host in self.domains.values(): + raise Errors.BadDomainSpecificationError( + 'Duplicate url host: %s' % url_host) + # We'll do the reverse mappings on-demand. There shouldn't be too + # many virtual hosts that it will really matter that much. + self.domains[email_host] = url_host + # Invalidate the reverse mapping cache + self._reverse = None + + # Given an email host name, the url host name can be looked up directly. + # This does the reverse mapping. + def get_email_host(self, url_host, default=None): + if self._reverse is None: + # XXX Can't use a generator comprehension until Python 2.4 is + # minimum requirement. + self._reverse = dict([(v, k) for k, v in self.domains.items()]) + return self._reverse.get(url_host, default) + + def add_runner(self, name, count=1): + """Convenient interface for adding additional qrunners. + + name is the qrunner name, and must include the 'Runner' suffix. + E.g. 'HTTPRunner' or 'LMTPRunner'. count is the number of qrunner + slices to create, by default, 1. + """ + self.QRUNNERS.append((name, count)) + + + +config = Configuration() diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py index 0f005b1a0..ae0007794 100644 --- a/Mailman/htmlformat.py +++ b/Mailman/htmlformat.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-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 @@ -12,8 +12,8 @@ # # 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. - +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Library for program-based construction of an HTML documents. @@ -21,14 +21,10 @@ Encapsulate HTML formatting directives in classes that act as containers for python and, recursively, for nested HTML formatting objects. """ - -# Eventually could abstract down to HtmlItem, which outputs an arbitrary html -# object given start / end tags, valid options, and a value. Ug, objects -# shouldn't be adding their own newlines. The next object should. - - -from Mailman import mm_cfg +from Mailman import Defaults from Mailman import Utils +from Mailman import Version +from Mailman.configuration import config from Mailman.i18n import _ SPACE = ' ' @@ -281,7 +277,7 @@ class Label(Container): class Document(Container): title = None language = None - bgcolor = mm_cfg.WEB_BG_COLOR + bgcolor = Defaults.WEB_BG_COLOR suppress_head = 0 def set_language(self, lang=None): @@ -305,9 +301,9 @@ class Document(Container): '', '' ]) - if mm_cfg.IMAGE_LOGOS: + if config.IMAGE_LOGOS: output.append('' % - (mm_cfg.IMAGE_LOGOS + mm_cfg.SHORTCUT_ICON)) + (config.IMAGE_LOGOS + config.SHORTCUT_ICON)) # Hit all the bases output.append('' % charset) @@ -316,12 +312,12 @@ class Document(Container): output.append('%s' % tab) quals = [] # Default link colors - if mm_cfg.WEB_VLINK_COLOR: - kws.setdefault('vlink', mm_cfg.WEB_VLINK_COLOR) - if mm_cfg.WEB_ALINK_COLOR: - kws.setdefault('alink', mm_cfg.WEB_ALINK_COLOR) - if mm_cfg.WEB_LINK_COLOR: - kws.setdefault('link', mm_cfg.WEB_LINK_COLOR) + if config.WEB_VLINK_COLOR: + kws.setdefault('vlink', config.WEB_VLINK_COLOR) + if config.WEB_ALINK_COLOR: + kws.setdefault('alink', config.WEB_ALINK_COLOR) + if config.WEB_LINK_COLOR: + kws.setdefault('link', config.WEB_LINK_COLOR) for k, v in kws.items(): quals.append('%s="%s"' % (k, v)) output.append('%s' % (tab, SPACE.join(quals))) @@ -336,7 +332,7 @@ class Document(Container): if tag is None: tag = _('Error: ') self.AddItem(Header(3, Bold(FontAttr( - _(tag), color=mm_cfg.WEB_ERROR_COLOR, size='+2')).Format() + + _(tag), color=config.WEB_ERROR_COLOR, size='+2')).Format() + Italic(errmsg).Format())) @@ -441,11 +437,11 @@ class SubmitButton(InputObj): InputObj.__init__(self, name, "SUBMIT", button_text, checked=0) class PasswordBox(InputObj): - def __init__(self, name, value='', size=mm_cfg.TEXTFIELDWIDTH): + def __init__(self, name, value='', size=Defaults.TEXTFIELDWIDTH): InputObj.__init__(self, name, "PASSWORD", value, checked=0, size=size) class TextBox(InputObj): - def __init__(self, name, value='', size=mm_cfg.TEXTFIELDWIDTH): + def __init__(self, name, value='', size=Defaults.TEXTFIELDWIDTH): InputObj.__init__(self, name, "TEXT", value, checked=0, size=size) class Hidden(InputObj): @@ -594,13 +590,12 @@ class DefinitionList(Container): # # These are the URLs which the image logos link to. The Mailman home page now # points at the gnu.org site instead of the www.list.org mirror. -# -from mm_cfg import MAILMAN_URL + PYTHON_URL = 'http://www.python.org/' GNU_URL = 'http://www.gnu.org/' # The names of the image logo files. These are concatentated onto -# mm_cfg.IMAGE_LOGOS (not urljoined). +# config.IMAGE_LOGOS (not urljoined). DELIVERED_BY = 'mailman.jpg' PYTHON_POWERED = 'PythonPowered.png' GNU_HEAD = 'gnu-head-tiny.jpg' @@ -608,11 +603,11 @@ GNU_HEAD = 'gnu-head-tiny.jpg' def MailmanLogo(): t = Table(border=0, width='100%') - if mm_cfg.IMAGE_LOGOS: + if config.IMAGE_LOGOS: def logo(file): - return mm_cfg.IMAGE_LOGOS + file + return config.IMAGE_LOGOS + file mmlink = 'Delivered by Mailman' \ - '
version %s' % (logo(DELIVERED_BY), mm_cfg.VERSION) + '
version %s' % (logo(DELIVERED_BY), Version.VERSION) pylink = 'Python Powered' % \ logo(PYTHON_POWERED) gnulink = 'GNU\'s Not Unix' % \ @@ -620,8 +615,8 @@ def MailmanLogo(): t.AddRow([mmlink, pylink, gnulink]) else: # use only textual links - version = mm_cfg.VERSION - mmlink = Link(MAILMAN_URL, + version = Version.VERSION + mmlink = Link(config.MAILMAN_URL, _('Delivered by Mailman
version %(version)s')) pylink = Link(PYTHON_URL, _('Python Powered')) gnulink = Link(GNU_URL, _("Gnu's Not Unix")) diff --git a/bin/Makefile.in b/bin/Makefile.in index f576606b3..9384e41bf 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -47,13 +47,13 @@ SHELL= /bin/sh SCRIPTS= mmshell \ remove_members clone_member \ sync_members check_db withlist \ - dumpdb cleanarch \ + cleanarch \ list_admins \ fix_url.py convert.py transcheck \ msgfmt.py discard \ reset_pw.py templ2pot.py po2templ.py -LN_SCRIPTS= add_members arch change_pw check_perms config_list \ +LN_SCRIPTS= add_members arch change_pw check_perms config_list dumpdb \ export find_member genaliases import inject list_lists \ list_members list_owners mailmanctl mmsitepass newlist \ qrunner rmlist show_config show_qfiles testall unshunt \ diff --git a/bin/dumpdb b/bin/dumpdb deleted file mode 100644 index 59170c6d4..000000000 --- a/bin/dumpdb +++ /dev/null @@ -1,137 +0,0 @@ -#! @PYTHON@ -# -# Copyright (C) 1998-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 sys -import pprint -import cPickle -import marshal -import optparse - -import paths - -from Mailman import mm_cfg -from Mailman.i18n import _ -__i18n_templates__ = True - - - -COMMASPACE = ', ' - -def parseargs(): - parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION, - usage=_("""\ -%%prog [options] filename - -Dump the contents of any Mailman `database' file. - -If the filename ends with `.db', then it is assumed that the file contains a -Python marshal. If the file ends with `.pck' then it is assumed to contain a -Python pickle. In either case, if you want to override the default assumption --- or if the file ends in neither suffix -- use the -p or -m flags.""")) - parser.add_option('-m', '--marshal', - default=False, action='store_true', - help=_("""\ -Assume the file contains a Python marshal, -overridding any automatic guessing.""")) - parser.add_option('-p', '--pickle', - default=False, action='store_true', - help=_("""\ -Assume the file contains a Python pickle, -overridding any automatic guessing.""")) - parser.add_option('-n', '--noprint', - default=False, action='store_true', - help=_("""\ -Don't attempt to pretty print the object. This is useful if there's -some problem with the object and you just want to get an unpickled -representation. Useful with `python -i bin/dumpdb '. In that -case, the root of the tree will be left in a global called "msg".""")) - opts, args = parser.parse_args() - # Options. - # None == guess, 0 == pickle, 1 == marshal - opts.filetype = None - if opts.pickle: - opts.filetype = 0 - if opts.marshal: - opts.filetype = 1 - opts.doprint = not opts.noprint - if len(args) < 1: - parser.print_help() - print >> sys.stderr, _('No filename given.') - sys.exit(1) - elif len(args) > 1: - parser.print_help() - pargs = COMMASPACE.join(args) - print >> sys.stderr, _('Bad arguments: $pargs') - sys.exit(1) - else: - opts.filename = args[0] - if opts.filetype is None: - if opts.filename.endswith('.db'): - opts.filetype = 1 - elif opts.filename.endswith('.pck'): - opts.filetype = 0 - else: - parser.print_help() - print >> sys.stderr, _('Please specify either -p or -m.') - sys.exit(1) - return parser, opts, args - - - -def main(): - parser, opts, args = parseargs() - - # Handle dbs - pp = pprint.PrettyPrinter(indent=4) - if opts.filetype == 1: - # BAW: this probably doesn't work if there are mixed types of .db - # files (i.e. some marshals, some bdbs). - load = marshal.load - typename = 'marshal' - else: - load = cPickle.load - typename = 'pickle' - fp = open(opts.filename) - m = [] - try: - cnt = 1 - if opts.doprint: - print _('[----- start $typename file -----]') - while True: - try: - obj = load(fp) - except EOFError: - if opts.doprint: - print _('[----- end $typename file -----]') - break - if opts.doprint: - print _('<----- start object $cnt ----->') - if isinstance(obj, str): - print obj - else: - pp.pprint(obj) - cnt += 1 - m.append(obj) - finally: - fp.close() - return m - - - -if __name__ == '__main__': - msg = main() diff --git a/bin/update b/bin/update deleted file mode 100755 index e69de29bb..000000000 diff --git a/configure b/configure index 6c82b0051..28752c831 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 8040 . +# From configure.in Revision: 8051 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for GNU Mailman 2.2.0a0. # @@ -4289,7 +4289,6 @@ build/bin/cleanarch:bin/cleanarch \ build/bin/clone_member:bin/clone_member \ build/bin/convert.py:bin/convert.py \ build/bin/discard:bin/discard \ -build/bin/dumpdb:bin/dumpdb \ build/bin/fix_url.py:bin/fix_url.py \ build/bin/list_admins:bin/list_admins \ build/bin/mmshell:bin/mmshell \ diff --git a/configure.in b/configure.in index d5017718d..6e28128a4 100644 --- a/configure.in +++ b/configure.in @@ -16,7 +16,7 @@ # USA. dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Revision: 8051 $) +AC_REVISION($Revision: 8086 $) AC_PREREQ(2.0) AC_INIT([GNU Mailman], [2.2.0a0]) @@ -597,7 +597,6 @@ bin/cleanarch \ bin/clone_member \ bin/convert.py \ bin/discard \ -bin/dumpdb \ bin/fix_url.py \ bin/list_admins \ bin/mmshell \ -- cgit v1.3.1