Attachment '1.6.3-commit-mails.patch'

Download

   1 From 35b2ec9fc10c423a7645e4e423c1557135a4d950 Mon Sep 17 00:00:00 2001
   2 From: Eygene Ryabinkin <rea@codelabs.ru>
   3 Date: Tue, 26 Feb 2008 18:47:02 +0300
   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 667e48a..4bafa63 100644
  23 --- a/MoinMoin/Page.py
  24 +++ b/MoinMoin/Page.py
  25 @@ -824,6 +824,25 @@ class Page(object):
  26              link += AttachFile.getIndicator(request, self.page_name)
  27  
  28          return link
  29 + 
  30 +    def _addMailingListSubscriber(self, subscriber_list, request, return_users):
  31 +        """
  32 +        Create a "bogus" user for a change notification mailing list.
  33 +        """
  34 +        if not return_users:
  35 +            subscriber_list.append(self.cfg.mail_to_address)
  36 +        else:
  37 +            name = self.cfg.commit_mail_to_name or ""
  38 +            subscriber = user.User(request,
  39 +                         name="commit_mailer", auth_username=name)
  40 +            subscriber.email = self.cfg.commit_mail_to_address
  41 +            subscriber.trusted = 0
  42 +            subscriber.language = self.cfg.language_default
  43 +            subscriber.subscribed_pages = [".*"]
  44 +            subscriber.show_fancy_diff = self.cfg.commit_mail_fancy_diff
  45 +            subscriber.want_trivial = 1
  46 +            subscriber.remember_me = 0
  47 +            subscriber_list.append(subscriber)
  48  
  49      def getSubscribers(self, request, **kw):
  50          """ Get all subscribers of this page.
  51 @@ -882,6 +901,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 f0da526..5d88f4e 100644
  65 --- a/MoinMoin/config/multiconfig.py
  66 +++ b/MoinMoin/config/multiconfig.py
  67 @@ -369,6 +369,11 @@ Lists: * bullets; 1., a. numbered items.
  68      mail_from = None # u'Juergen Wiki <noreply@jhwiki.org>'
  69      mail_expand_to = False # set to True if you want all recipients to be listed in To: field
  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_subpage_template = u"$from-$date-$subject" # used for mail import
  77      mail_import_pagename_search = ['subject', 'to', ] # where to look for target pagename (and in which order)
  78      mail_import_pagename_envelope = u"%s" # use u"+ %s/" to add "+ " and "/" automatically
  79 diff --git a/wiki/config/wikiconfig.py b/wiki/config/wikiconfig.py
  80 index 15c5cd8..8063ef2 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.5.3

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.
  • [get | view] (2008-06-20 15:32:52, 4.2 KB) [[attachment:1.6.3-commit-mails.patch]]
  • [get | view] (2008-09-15 20:08:30, 4.1 KB) [[attachment:1.7.2-commit-mails.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.