[Spambayes-checkins] spambayes/spambayes message.py,1.67,1.68

Tony Meyer anadelonbrin at users.sourceforge.net
Tue Mar 29 09:16:48 CEST 2005


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32706/spambayes

Modified Files:
	message.py 
Log Message:
Expose the mange_from option for flattening message objects.

Index: message.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** message.py	4 Jan 2005 03:06:06 -0000	1.67
--- message.py	29 Mar 2005 07:16:45 -0000	1.68
***************
*** 99,102 ****
--- 99,103 ----
  import email.Parser
  import email.Header
+ import email.Generator
  
  from spambayes import storage
***************
*** 355,359 ****
          return CRLF_RE.sub('\r\n', data)
  
!     def as_string(self, unixfrom=False):
          # The email package stores line endings in the "internal" Python
          # format ('\n').  It is up to whoever transmits that information to
--- 356,360 ----
          return CRLF_RE.sub('\r\n', data)
  
!     def as_string(self, unixfrom=False, mangle_from_=True):
          # The email package stores line endings in the "internal" Python
          # format ('\n').  It is up to whoever transmits that information to
***************
*** 362,367 ****
          # append function), but does not, so we do it here
          try:
!             return self._force_CRLF(\
!                 email.Message.Message.as_string(self, unixfrom))
          except TypeError:
              parts = []
--- 363,370 ----
          # append function), but does not, so we do it here
          try:
!             fp = StringIO.StringIO()
!             g = email.Generator.Generator(fp, mangle_from_=mangle_from_)
!             g.flatten(self, unixfrom)
!             return self._force_CRLF(fp.getvalue())
          except TypeError:
              parts = []



More information about the Spambayes-checkins mailing list