[Python-checkins] python/dist/src/Lib/email quopriMIME.py,1.4,1.5

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Wed, 05 Mar 2003 21:14:22 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv31474

Modified Files:
	quopriMIME.py 
Log Message:
Merge of the folding-reimpl-branch.  Specific changes,

_max_append(): Change the comparison so that the new string is
concatenated if it's less than or equal to the max length.

header_encode(): Allow for maxlinelen == None to mean, don't do any
line splitting.  This is because this module is mostly used by higher
level abstractions (Header.py) which already ensures line lengths.  We
do this in a cheapo way by setting the max_encoding to some insanely
<100k wink> large number.


Index: quopriMIME.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** quopriMIME.py	28 Sep 2002 21:02:51 -0000	1.4
--- quopriMIME.py	6 Mar 2003 05:14:20 -0000	1.5
***************
*** 83,87 ****
      if not L:
          L.append(s.lstrip())
!     elif len(L[-1]) + len(s) < maxlen:
          L[-1] += extra + s
      else:
--- 83,87 ----
      if not L:
          L.append(s.lstrip())
!     elif len(L[-1]) + len(s) <= maxlen:
          L[-1] += extra + s
      else:
***************
*** 117,121 ****
  
      with each line wrapped safely at, at most, maxlinelen characters (defaults
!     to 76 characters).
  
      End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted
--- 117,122 ----
  
      with each line wrapped safely at, at most, maxlinelen characters (defaults
!     to 76 characters).  If maxlinelen is None, the entire string is encoded in
!     one chunk with no splitting.
  
      End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted
***************
*** 135,141 ****
  
      # Quopri encode each line, in encoded chunks no greater than maxlinelen in
!     # lenght, after the RFC chrome is added in.
      quoted = []
!     max_encoded = maxlinelen - len(charset) - MISC_LEN
  
      for c in header:
--- 136,146 ----
  
      # Quopri encode each line, in encoded chunks no greater than maxlinelen in
!     # length, after the RFC chrome is added in.
      quoted = []
!     if maxlinelen is None:
!         # An obnoxiously large number that's good enough
!         max_encoded = 100000
!     else:
!         max_encoded = maxlinelen - len(charset) - MISC_LEN - 1
  
      for c in header: