summaryrefslogtreecommitdiff
path: root/modules/mm_utils.py
diff options
context:
space:
mode:
authorklm1998-04-27 20:20:43 +0000
committerklm1998-04-27 20:20:43 +0000
commit9a9c8d86846386741d956aef91aa1e619a8333b2 (patch)
tree2d71e1b42011cc46ddaa3d7435d0962ed5ba2516 /modules/mm_utils.py
parent28623db8880b07acec40b3dcdc37c9beab55fbd5 (diff)
downloadmailman-9a9c8d86846386741d956aef91aa1e619a8333b2.tar.gz
mailman-9a9c8d86846386741d956aef91aa1e619a8333b2.tar.zst
mailman-9a9c8d86846386741d956aef91aa1e619a8333b2.zip
New routine change_boundary, for substituting one mime boundary for
another.
Diffstat (limited to 'modules/mm_utils.py')
-rw-r--r--modules/mm_utils.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/mm_utils.py b/modules/mm_utils.py
index 7b78a534f..033e68dc8 100644
--- a/modules/mm_utils.py
+++ b/modules/mm_utils.py
@@ -5,7 +5,7 @@ message and address munging, a handy-dandy routine to map a function on all
the maillists, the Logging routines, and whatever else doesn't belong
elsewhere."""
-__version__ = "$Revision: 464 $"
+__version__ = "$Revision: 478 $"
import sys, string, fcntl, os, random, regsub, re
@@ -388,3 +388,19 @@ class StampedLogger(Logger):
Logger.write(self, ' ' + l)
else:
Logger.write(self, l)
+
+def change_boundary(text, boundary, reboundary):
+ """Substitute good boundary for simplistic one in mime messages."""
+ got = []
+ open_b = "--" + boundary
+ close_b = "--" + boundary + "--"
+ open_reb = "--" + reboundary
+ close_reb = "--" + reboundary + "--"
+ for i in string.split(text, '\n'):
+ if i == open_b:
+ got.append(open_reb)
+ elif i == close_b:
+ got.append(close_reb)
+ else:
+ got.append(i)
+ return string.join(got, '\n')