1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/usr/local/bin/python
# Copyright (C) 1998 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., 59 Temple Place - Suite 330, Boston, MA 0211-1307, USA.
"Invoked by cron, checks for pending list requests and mails the admin if any."
__version__ = "$Revision: 539 $"
import sys, os
sys.path.append('/home/mailman/mailman/modules')
import maillist, mm_cfg, mm_message, mm_utils
def main():
for name in mm_utils.list_names():
list = maillist.MailList(name)
list.Unlock()
count = list.RequestsPending()
if count:
list.SendTextToUser(subject = '%d %s admin request(s) waiting' %
(count, list.real_name),
recipient = list.GetAdminEmail(),
text = '''
The %s mailing list has %d request(s) waiting
for your consideration at:
%s
Please attend to this at your earliest convenience. A reminder like this
of the pending requests, if any, will be sent out daily.
%s
''' % (list.real_name, count, list.GetScriptURL('admindb'),
pending_requests(list)))
def pending_requests(list):
import time, string
pending = []
requests = list.requests
# First the pending subscriptions:
if requests.has_key('add_member'):
pending.append("Pending subscriptions:")
for req in requests['add_member']:
id, when, digested, who, pwd = req
pending.append("\t%s %s" %
(string.strip(who),
time.ctime(when)))
if requests.has_key('post'):
if pending:
pending.append("")
pending.append("Pending posts:")
for req in requests['post']:
id, when, (who, msg), cause, subj = req
pending.append("\tFrom: %s on %s:\n\tCause: %s"
% (string.strip(who),
time.ctime(when),
`string.strip(cause)`))
return string.join(pending, '\n')
if __name__ == "__main__":
main()
|