# Copyright (C) 2009 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. """Set a list's digestable flag to No and set all current digest members to regular delivery. Save as bin/set_nodigest.py Run via bin/withlist -r set_nodigest [options] Options: -h --help Print this message. """ import sys import getopt from Mailman import mm_cfg def usage(code, msg=''): if code: fd = sys.stderr else: fd = sys.stdout print >> fd, __doc__ if msg: print >> fd, msg sys.exit(code) def set_nodigest(mlist, *args): try: opts, args = getopt.getopt(args, 'h', ['help']) except getopt.error, msg: usage(1, msg) for opt, arg in opts: if opt in ('-h', '--help'): usage(0) if not mlist.Locked(): mlist.Lock() mlist.digestable = 0 for member in mlist.getDigestMemberKeys(): mlist.setMemberOption(member, mm_cfg.Digests, 0) mlist.Save() mlist.Unlock()