summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormailman1998-04-02 20:43:07 +0000
committermailman1998-04-02 20:43:07 +0000
commit70a118cee0003f6ae66b80aa91f8c2d387c13402 (patch)
tree57885b67591605640367d96c1023ab448fa204c7
parentbfe5cd95d21a02aadd157aedb74817222414b3af (diff)
downloadmailman-70a118cee0003f6ae66b80aa91f8c2d387c13402.tar.gz
mailman-70a118cee0003f6ae66b80aa91f8c2d387c13402.tar.zst
mailman-70a118cee0003f6ae66b80aa91f8c2d387c13402.zip
-rw-r--r--Mailman/Message.py15
-rw-r--r--modules/mm_message.py15
2 files changed, 30 insertions, 0 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py
index c281f9863..61ac922b6 100644
--- a/Mailman/Message.py
+++ b/Mailman/Message.py
@@ -85,6 +85,21 @@ class IncomingMessage(rfc822.Message):
string.lower(name) + ':'):
self.headers[i] = '%s: %s' % (name, value)
+ # XXX delitem should be removed when rfc822.Message() has its own,
+ # possibly in Python 1.5.1. klm 04/98.
+ def delitem(self, name):
+ """Remove all headers with the specified name.
+
+ None is returned if the named header is not present."""
+ lname = string.lower(name)
+ if not self.dict.has_key(name):
+ return None
+ del self.dict[name]
+ for i in range(1, len(self.headers)):
+ h = self.headers[-1 * i]
+ if len(h) > len(name) and string.lower(h[0:len(name)]) == name:
+ del self.headers[-1 * i]
+
# This is a simplistic class. It could do multi-line headers etc...
# But it doesn't because I don't need that for this app.
class OutgoingMessage:
diff --git a/modules/mm_message.py b/modules/mm_message.py
index c281f9863..61ac922b6 100644
--- a/modules/mm_message.py
+++ b/modules/mm_message.py
@@ -85,6 +85,21 @@ class IncomingMessage(rfc822.Message):
string.lower(name) + ':'):
self.headers[i] = '%s: %s' % (name, value)
+ # XXX delitem should be removed when rfc822.Message() has its own,
+ # possibly in Python 1.5.1. klm 04/98.
+ def delitem(self, name):
+ """Remove all headers with the specified name.
+
+ None is returned if the named header is not present."""
+ lname = string.lower(name)
+ if not self.dict.has_key(name):
+ return None
+ del self.dict[name]
+ for i in range(1, len(self.headers)):
+ h = self.headers[-1 * i]
+ if len(h) > len(name) and string.lower(h[0:len(name)]) == name:
+ del self.headers[-1 * i]
+
# This is a simplistic class. It could do multi-line headers etc...
# But it doesn't because I don't need that for this app.
class OutgoingMessage: