Attachment '1.7.2-commit-mails.patch'
Download 1 From 8303af92996915abbb3af81369e3b0add8b7cb4f Mon Sep 17 00:00:00 2001
2 From: Eygene Ryabinkin <rea@codelabs.ru>
3 Date: Mon, 15 Sep 2008 22:04:47 +0400
4 Subject: [PATCH] Implement VCS-like commit messages.
5
6 This patch enables MoinMoin to send commit mails for every change
7 of every Wiki page: the Wiki-wide changes subscription. Patch is
8 based on the ASF's work [1]: it is sligtly modified to work for
9 1.6.1 and additional configuration directive, commit_mail_fancy_diff,
10 was added.
11
12 [1] http://moinmo.in/MoinMoinPatch/CommitMails
13
14 Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
15 ---
16 MoinMoin/Page.py | 24 ++++++++++++++++++++++++
17 MoinMoin/config/multiconfig.py | 5 +++++
18 wiki/config/wikiconfig.py | 15 +++++++++++++++
19 3 files changed, 44 insertions(+), 0 deletions(-)
20
21 diff --git a/MoinMoin/Page.py b/MoinMoin/Page.py
22 index 7727cea..07de32d 100644
23 --- a/MoinMoin/Page.py
24 +++ b/MoinMoin/Page.py
25 @@ -807,6 +807,25 @@ class Page(object):
26
27 return link
28
29 + def _addMailingListSubscriber(self, subscriber_list, request, return_users):
30 + """
31 + Create a "bogus" user for a change notification mailing list.
32 + """
33 + if not return_users:
34 + subscriber_list.append(self.cfg.mail_to_address)
35 + else:
36 + name = self.cfg.commit_mail_to_name or ""
37 + subscriber = user.User(request,
38 + name="commit_mailer", auth_username=name)
39 + subscriber.email = self.cfg.commit_mail_to_address
40 + subscriber.trusted = 0
41 + subscriber.language = self.cfg.language_default
42 + subscriber.subscribed_pages = [".*"]
43 + subscriber.show_fancy_diff = self.cfg.commit_mail_fancy_diff
44 + subscriber.want_trivial = 1
45 + subscriber.remember_me = 0
46 + subscriber_list.append(subscriber)
47 +
48 def getSubscribers(self, request, **kw):
49 """ Get all subscribers of this page.
50
51 @@ -868,6 +887,11 @@ class Page(object):
52 else:
53 subscriber_list[lang].append(subscriber.email)
54
55 + # send cvs-style commit messages please
56 + if not subscriber_list.has_key('en'): subscriber_list['en'] = []
57 + if getattr(self.cfg, "cvs_style_commit_messages", None):
58 + self._addMailingListSubscriber(subscriber_list['en'], request, return_users)
59 +
60 return subscriber_list
61
62 def parse_processing_instructions(self):
63 diff --git a/MoinMoin/config/multiconfig.py b/MoinMoin/config/multiconfig.py
64 index 80e27c1..1e3ee5a 100644
65 --- a/MoinMoin/config/multiconfig.py
66 +++ b/MoinMoin/config/multiconfig.py
67 @@ -379,6 +379,11 @@ Lists: * bullets; 1., a. numbered items.
68 mail_smarthost = None # your SMTP mail server
69 mail_sendmail = None # "/usr/sbin/sendmail -t -i" to not use SMTP, but sendmail
70
71 + cvs_style_commit_messages = 0
72 + commit_mail_to_name = None
73 + commit_mail_to_address = None
74 + commit_mail_fancy_diff = 0
75 +
76 mail_import_secret = "" # a shared secret also known to the mail importer xmlrpc script
77 mail_import_subpage_template = u"$from-$date-$subject" # used for mail import
78 mail_import_pagename_search = ['subject', 'to', ] # where to look for target pagename (and in which order)
79 diff --git a/wiki/config/wikiconfig.py b/wiki/config/wikiconfig.py
80 index 20b90f4..f702df2 100644
81 --- a/wiki/config/wikiconfig.py
82 +++ b/wiki/config/wikiconfig.py
83 @@ -124,6 +124,21 @@ class Config(DefaultConfig):
84 # Default is to use 'mail_from' as a To: field contents.
85 #mail_expand_to = False
86
87 + # Send CVS-style commit messages for every change, as an anti-spam
88 + # measure? Off by default, set to 1 to enable
89 + #cvs_style_commit_messages = 0
90 +
91 + # The name to use in the To line of CVS-style commit messages,
92 + # e.g. u"Jürgen Wiki" [Unicode]
93 + #commit_mail_to_name = u""
94 +
95 + # The address to send CVS-style commit messages to, e.g.
96 + # "<allcommits@mywiki.org>"
97 + #commit_mail_to_address = ""
98 +
99 + # Use fancy diffs or the plain ones?
100 + #commit_mail_fancy_diff = False
101 +
102
103 # User interface ----------------------------------------------------
104
105 --
106 1.5.6.4
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.