[Spambayes-checkins] spambayes/spambayes message.py,1.30,1.31

Richie Hindle richiehindle at users.sourceforge.net
Fri Jul 18 15:20:01 EDT 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv29031

Modified Files:
	message.py 
Log Message:
Line-wrap the very long X-Spambayes-Evidence header. 


Index: message.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** message.py	18 Jul 2003 20:19:32 -0000	1.30
--- message.py	18 Jul 2003 21:19:58 -0000	1.31
***************
*** 290,294 ****
                  if (word[0] == '*' or score <= hco or score >= sco):
                      evd.append("%r: %.2f" % (word, score))
!             self[options['Headers','evidence_header_name']] = "; ".join(evd)
  
          # These are pretty ugly, but no-one has a better idea about how to
--- 290,310 ----
                  if (word[0] == '*' or score <= hco or score >= sco):
                      evd.append("%r: %.2f" % (word, score))
! 
!             # Line-wrap this header, because it can get very long.  We don't
!             # use email.Header.Header because that can explode with unencoded
!             # non-ASCII characters.  We can't use textwrap because that's 2.3.
!             wrappedEvd = []
!             headerName = options['Headers','evidence_header_name']
!             lineLength = len(headerName) + len(': ')
!             for component, index in zip(evd, range(len(evd))):
!                 wrappedEvd.append(component)
!                 lineLength += len(component)
!                 if index < len(evd)-1:
!                     if lineLength + len('; ') + len(evd[index+1]) < 78:
!                         wrappedEvd.append('; ')
!                     else:
!                         wrappedEvd.append(';\n\t')
!                         lineLength = 8
!             self[headerName] = "".join(wrappedEvd)
  
          # These are pretty ugly, but no-one has a better idea about how to





More information about the Spambayes-checkins mailing list