CVS: tmda/TMDA/pythonlib/email Generator.py,1.7,1.8
"Jason R. Mastaler" <[email protected]>
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda/TMDA/pythonlib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv13283
Modified Files:
Generator.py
Log Message:
Add the HeaderParsedGenerator class. This is Tim's patch that is part
of a mimelib bug report and should eventually make it into the Python
email package. We simply can't afford to wait until that happens.
Index: Generator.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/pythonlib/email/Generator.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Generator.py 9 Jul 2003 17:58:25 -0000 1.7
+++ Generator.py 30 Jul 2003 19:32:54 -0000 1.8
@@ -356,6 +356,26 @@
+class HeaderParsedGenerator(Generator):
+ """Generate text from a Message created by HeaderParser.
+
+ Header is generated as usual (by Generator). The payload of a Message
+ created by HeaderParser is a raw string. No encoding is necessary. If it
+ came in valid, it goes out valid. Conversely, if it came in bogus, it goes
+ out bogus.
+ """
+ def _dispatch(self, msg):
+ payload = msg.get_payload()
+ if payload is None:
+ return
+ if not _isstring(payload):
+ raise TypeError, 'string payload expected: %s' % type(payload)
+ if self._mangle_from_:
+ payload = fcre.sub('>From ', payload)
+ self._fp.write(payload)
+
+
+
# Helper
_width = len(repr(sys.maxint-1))
_fmt = '%%0%dd' % _width
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs