Merge branch 'xorg/maint'
[platal.git] / upgrade / 0.9.1 / mailman_update.py
1 #!/usr/bin/env python
2 #***************************************************************************
3 #* Copyright (C) 2003-2014 Polytechnique.org *
4 #* http://opensource.polytechnique.org/ *
5 #* *
6 #* This program is free software; you can redistribute it and/or modify *
7 #* it under the terms of the GNU General Public License as published by *
8 #* the Free Software Foundation; either version 2 of the License, or *
9 #* (at your option) any later version. *
10 #* *
11 #* This program is distributed in the hope that it will be useful, *
12 #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 #* GNU General Public License for more details. *
15 #* *
16 #* You should have received a copy of the GNU General Public License *
17 #* along with this program; if not, write to the Free Software *
18 #* Foundation, Inc., *
19 #* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 #***************************************************************************
21
22 import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha
23
24 sys.path.append('/usr/lib/mailman/bin')
25
26 from pwd import getpwnam
27 from grp import getgrnam
28
29 from SimpleXMLRPCServer import SimpleXMLRPCServer
30 from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
31
32 import paths
33 from Mailman import MailList
34 from Mailman import Utils
35 from Mailman import Message
36 from Mailman import Errors
37 from Mailman import mm_cfg
38 from Mailman import i18n
39 from Mailman.UserDesc import UserDesc
40 from Mailman.ListAdmin import readMessage
41 from email.Iterators import typed_subpart_iterator
42
43 names = Utils.list_names()
44 for listname in names:
45 try:
46 mlist = MailList.MailList(listname,lock=0)
47 except:
48 print 'ERROR '+listname
49 continue
50 try:
51 print 'BEGIN '+listname
52 mlist.Lock()
53 mlist.header_filter_rules = []
54 mlist.header_filter_rules.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
55 print ' set new bogofilter policy'
56 mlist.Save()
57 mlist.Unlock()
58 print 'END'
59 except:
60 mlist.Unlock()
61 print 'ERROR '+listname
62
63
64 # vim:set et: