[Spambayes-checkins] spambayes unheader.py,1.4,1.5
Greg Ward
gward@users.sourceforge.net
Tue, 24 Sep 2002 19:02:43 -0700
Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv19599
Modified Files:
unheader.py
Log Message:
Fix deSA() so it doesn't discard the first line of the body.
Change process_mailbox() to use email.Generator directly, in order
to disable header-wrapping and preserve headers as much as possible.
Index: unheader.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/unheader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** unheader.py 24 Sep 2002 17:59:58 -0000 1.4
--- unheader.py 25 Sep 2002 02:02:41 -0000 1.5
***************
*** 6,9 ****
--- 6,10 ----
import email.Parser
import email.Message
+ import email.Generator
import getopt
***************
*** 51,60 ****
elif at_start:
at_start = 0
! else:
! newbody.append(line)
msg.set_payload("\n".join(newbody))
unheader(msg, "X-Spam-")
def process_mailbox(f, dosa=1, pats=None):
for msg in mailbox.PortableUnixMailbox(f, Parser().parse):
if pats is not None:
--- 52,61 ----
elif at_start:
at_start = 0
! newbody.append(line)
msg.set_payload("\n".join(newbody))
unheader(msg, "X-Spam-")
def process_mailbox(f, dosa=1, pats=None):
+ gen = email.Generator.Generator(sys.stdout, maxheaderlen=0)
for msg in mailbox.PortableUnixMailbox(f, Parser().parse):
if pats is not None:
***************
*** 62,66 ****
if dosa:
deSA(msg)
! print msg
def usage():
--- 63,67 ----
if dosa:
deSA(msg)
! gen(msg, unixfrom=1)
def usage():