Happy New Year !
[platal.git] / bin / devel / lists.foreach_template.py
CommitLineData
0337d704 1#!/usr/bin/env python
2#***************************************************************************
ba6ae046 3#* Copyright (C) 2003-2013 Polytechnique.org *
0337d704 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
22import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal
23
24sys.path.append('/usr/lib/mailman/bin')
25
26from pwd import getpwnam
27from grp import getgrnam
28
29from SimpleXMLRPCServer import SimpleXMLRPCServer
30from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
31
32import paths
33from Mailman import MailList
34from Mailman import Utils
35from Mailman import Message
36from Mailman import Errors
37from Mailman import mm_cfg
38from Mailman import i18n
39from Mailman.UserDesc import UserDesc
40from Mailman.ListAdmin import readMessage
41from email.Iterators import typed_subpart_iterator
42
43
44uid = getpwnam(mm_cfg.MAILMAN_USER)[2]
45gid = getgrnam(mm_cfg.MAILMAN_GROUP)[2]
46
47if not os.getuid():
48 os.setregid(gid,gid)
49 os.setreuid(uid,uid)
50
51if ( os.getuid() is not uid ) or ( os.getgid() is not gid):
52 sys.exit(0)
53
54
55for listname in Utils.list_names():
56 try:
57 mlist = MailList.MailList(listname,lock=0)
58 except:
59 print 'ERROR for '+listname
60 continue
61 try:
62 mlist.Lock()
63
64 ############################################
65 # do treatement here
66 ############################################
67
68 mlist.Save()
69 mlist.Unlock()
70 print 'OK for '+listname
71 except:
72 print 'ERROR for '+listname
73 continue
74
75print 'DONE'
76
77# vim:set et: