Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1:/tmp/cvs-serv8496/TMDA
Modified Files:
ChangeLog
Added Files:
Message.py
Log Message:
Add our own message module which inherits from email.Message. We do
this to change certain default behaviors such as "From" with ">".
It's not the job of the MUA to escape From, so we change this in
tmda-inject.
This is a half-assed fix, because we need to do this to the
tmda-filter side as well, since escaping only needs to be done when
delivering to mbox files. However, this has proven more difficult than
anticipated, so it will have to wait.
--- NEW FILE ---
# -*- python -*-
#
# Copyright (C) 2001,2002,2003 Jason R. Mastaler <[EMAIL PROTECTED]>
#
# This file is part of TMDA.
#
# TMDA is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of this license should
# be included in the file COPYING.
#
# TMDA is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with TMDA; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Standard TMDA Message Object"""
from cStringIO import StringIO
from email.Generator import Generator
from email.Parser import Parser
import email.Message
class Message(email.Message.Message):
"""Inherit from email.Message so we can override some methods
whose behavior we need to change."""
def __init__(self):
email.Message.Message.__init__(self)
def as_string(self, unixfrom=0):
fp = StringIO()
g = Generator(fp, mangle_from_=0) # don't escape From
g.flatten(self, unixfrom=unixfrom)
return fp.getvalue()
def message_from_file(fp, _class=None, strict=0):
if _class is None:
_class = Message
return Parser(_class, strict=strict).parse(fp)
def message_from_string(s, _class=None, strict=0):
if _class is None:
_class = Message
return Parser(_class, strict=strict).parsestr(s)
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -r1.253 -r1.254
--- ChangeLog 30 Jan 2003 23:32:35 -0000 1.253
+++ ChangeLog 20 Feb 2003 22:52:31 -0000 1.254
@@ -1,3 +1,7 @@
+2003-02-20 Jason R. Mastaler <[EMAIL PROTECTED]>
+
+ * Message.py: New module.
+
2003-01-30 Jason R. Mastaler <[EMAIL PROTECTED]>
* Deliver.py (Deliver.__deliver_mbox): The UUCP-style From_ line's
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs