X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=upgrade%2F0.9.1%2Fmailman_update.py;fp=upgrade%2F0.9.1%2Fmailman_update.py;h=be52a436a98883621deddc75b23e987ca0062292;hb=0337d704b62718d7c77106c0e4c4e26fb02beacf;hp=0000000000000000000000000000000000000000;hpb=04fd02e59b1bdc430c7a7dcc1ca9f4cbc2b04037;p=platal.git diff --git a/upgrade/0.9.1/mailman_update.py b/upgrade/0.9.1/mailman_update.py new file mode 100755 index 0000000..be52a43 --- /dev/null +++ b/upgrade/0.9.1/mailman_update.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +#*************************************************************************** +#* Copyright (C) 2004 polytechnique.org * +#* http://opensource.polytechnique.org/ * +#* * +#* 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., * +#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * +#*************************************************************************** + +import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha + +sys.path.append('/usr/lib/mailman/bin') + +from pwd import getpwnam +from grp import getgrnam + +from SimpleXMLRPCServer import SimpleXMLRPCServer +from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler + +import paths +from Mailman import MailList +from Mailman import Utils +from Mailman import Message +from Mailman import Errors +from Mailman import mm_cfg +from Mailman import i18n +from Mailman.UserDesc import UserDesc +from Mailman.ListAdmin import readMessage +from email.Iterators import typed_subpart_iterator + +names = Utils.list_names() +for listname in names: + try: + mlist = MailList.MailList(listname,lock=0) + except: + print 'ERROR '+listname + continue + try: + print 'BEGIN '+listname + mlist.Lock() + mlist.header_filter_rules = [] + mlist.header_filter_rules.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False)) + print ' set new bogofilter policy' + mlist.Save() + mlist.Unlock() + print 'END' + except: + mlist.Unlock() + print 'ERROR '+listname + + +# vim:set et: