------------------------------------------------------------
revno: 1697
fixes bug: https://launchpad.net/bugs/1673307
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Wed 2017-03-15 20:39:27 -0700
message:
  Treat message and digest headers and footers as empty if they contain
  only whitespace.
modified:
  Mailman/Handlers/Decorate.py
  Mailman/Handlers/ToDigest.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Handlers/Decorate.py'
--- Mailman/Handlers/Decorate.py	2017-03-04 21:21:54 +0000
+++ Mailman/Handlers/Decorate.py	2017-03-16 03:39:27 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2017 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
@@ -210,7 +210,11 @@
 
 def decorate(mlist, template, what, extradict=None):
     # `what' is just a descriptive phrase used in the log message
-    #
+    
+    # If template is only whitespace, ignore it.
+    if len(re.sub('\s', '', template)) == 0:
+        return ''
+
     # BAW: We've found too many situations where Python can be fooled into
     # interpolating too much revealing data into a format string.  For
     # example, a footer of "% silly %(real_name)s" would give a header

=== modified file 'Mailman/Handlers/ToDigest.py'
--- Mailman/Handlers/ToDigest.py	2016-11-23 21:27:00 +0000
+++ Mailman/Handlers/ToDigest.py	2017-03-16 03:39:27 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2017 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
@@ -215,8 +215,8 @@
     # RFC 1153
     print >> plainmsg, mastheadtxt
     print >> plainmsg
-    # Now add the optional digest header
-    if mlist.digest_header:
+    # Now add the optional digest header but only if more than whitespace.
+    if re.sub('\s', '', mlist.digest_header):
         headertxt = decorate(mlist, mlist.digest_header, _('digest header'))
         # MIME
         header = MIMEText(headertxt, _charset=lcset)
@@ -365,8 +365,8 @@
         print >> plainmsg, payload
         if not payload.endswith('\n'):
             print >> plainmsg
-    # Now add the footer
-    if mlist.digest_footer:
+    # Now add the footer but only if more than whitespace.
+    if re.sub('\s', '', mlist.digest_footer):
         footertxt = decorate(mlist, mlist.digest_footer, _('digest footer'))
         # MIME
         footer = MIMEText(footertxt, _charset=lcset)

=== modified file 'NEWS'
--- NEWS	2017-03-04 21:21:54 +0000
+++ NEWS	2017-03-16 03:39:27 +0000
@@ -26,6 +26,9 @@
 
   Bug fixes and other patches
 
+    - Treat message and digest headers and footers as empty if they contain
+      only whitespace.  (LP: #1673307)
+
     - Ensured that added message and digest headers and footers always have
       a terminating new-line.  (LP: #1670033)
 

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to