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

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Sun, 02 Mar 2003 22:51:29 -0800


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

Modified Files:
      Tag: folding-reimpl-branch
	quopriMIME.py 
Log Message:
_max_append(): Comparison should allow for concatenation if the
resulting length is equal to the max length.

header_encode(): Allow for maxlinelen=None to mean no splitting of
long lines.  Higher level functions such as Header.encode() know what
the chunk lengths should be so they don't want header_encode() second
guessing them (there isn't a convenient way to thread the maxlinelen
and continuation_ws all the way through).


Index: quopriMIME.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v
retrieving revision 1.4
retrieving revision 1.4.8.1
diff -C2 -d -r1.4 -r1.4.8.1
*** quopriMIME.py	28 Sep 2002 21:02:51 -0000	1.4
--- quopriMIME.py	3 Mar 2003 06:51:27 -0000	1.4.8.1
***************
*** 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: