Details
- Applies to
- moin-1.5.1
- Purpose
- sends CVS-style "commit" emails to a configuration-defined address on every change
- Description
To moderate a wiki, either for fact-checking or simply to ensure it doesn't get polluted by spam, it is useful to have every change mailed to mailing list or moderator address. This patch implements this. It is an updated version of the patch we run at the ASF.
This updated version of the patch now includes documentation for the configuration settings it creates. It obsoletes the patch listed on the MoinMoinPatch page as "Send change notifications based on config file".
Patch
1 diff -ru ORIGS/MoinMoin/Page.py ./MoinMoin/Page.py
2 --- ORIGS/MoinMoin/Page.py 2006-01-24 22:34:26.568017043 +0000
3 +++ ./MoinMoin/Page.py 2006-01-24 21:49:57.000000000 +0000
4 @@ -887,6 +887,25 @@
5
6 return link
7
8 + def _addMailingListSubscriber(self, subscriber_list, request, return_users):
9 + """
10 + Create a "bogus" user for a change notification mailing list.
11 + """
12 + if not return_users:
13 + subscriber_list.append(self.cfg.mail_to_address)
14 + else:
15 + name = self.cfg.commit_mail_to_name or ""
16 + subscriber = user.User(request,
17 + name="commit_mailer", auth_username=name)
18 + subscriber.email = self.cfg.commit_mail_to_address
19 + subscriber.trusted = 0
20 + subscriber.language = self.cfg.language_default
21 + subscriber.subscribed_pages = [".*"]
22 + subscriber.show_fancy_diff = 1
23 + subscriber.want_trivial = 1
24 + subscriber.remember_me = 0
25 + subscriber_list.append(subscriber)
26 +
27 def getSubscribers(self, request, **kw):
28 """
29 Get all subscribers of this page.
30 @@ -940,6 +959,11 @@
31 else:
32 subscriber_list[lang].append(subscriber.email)
33
34 + # send cvs-style commit messages please
35 + if not subscriber_list.has_key('en'): subscriber_list['en'] = []
36 + if getattr(self.cfg, "cvs_style_commit_messages", None):
37 + self._addMailingListSubscriber(subscriber_list['en'], request, return_users)
38 +
39 return subscriber_list
40
41
42 diff -ru ORIGS/MoinMoin/multiconfig.py ./MoinMoin/multiconfig.py
43 --- ORIGS/MoinMoin/multiconfig.py 2006-01-24 22:34:26.595009363 +0000
44 +++ ./MoinMoin/multiconfig.py 2006-01-24 21:47:12.000000000 +0000
45 @@ -237,6 +237,10 @@
46 mail_sendmail = None # "/usr/sbin/sendmail -t -i" to not use SMTP, but sendmail
47 mail_smarthost = None
48 mail_from = None # u'Jürgen Wiki <noreply@jhwiki.org>'
49 +
50 + cvs_style_commit_messages = 0
51 + commit_mail_to_name = None
52 + commit_mail_to_address = None
53
54 navi_bar = [u'RecentChanges', u'FindPage', u'HelpContents', ]
55 nonexist_qm = 0
56 diff -ru ORIGS/wiki/config/wikiconfig.py ./wiki/config/wikiconfig.py
57 --- ORIGS/wiki/config/wikiconfig.py 2006-01-24 22:34:44.875808478 +0000
58 +++ ./wiki/config/wikiconfig.py 2006-01-24 21:58:34.000000000 +0000
59 @@ -113,6 +113,18 @@
60 # "user pwd" if you need to use SMTP AUTH
61 #mail_login = ""
62
63 + # Send CVS-style commit messages for every change, as an anti-spam
64 + # measure? Off by default, set to 1 to enable
65 + #cvs_style_commit_messages = 0
66 +
67 + # The name to use in the To line of CVS-style commit messages,
68 + # e.g. u"Jürgen Wiki" [Unicode]
69 + #commit_mail_to_name = u""
70 +
71 + # The address to send CVS-style commit messages to, e.g.
72 + # "<allcommits@mywiki.org>"
73 + #commit_mail_to_address = ""
74 +
75
76 # User interface ----------------------------------------------------
77
Discussion
Plan
- Priority:
- Assigned to:
- Status: