[Python-checkins] python/dist/src/Lib/email Generator.py,1.6.10.4,1.6.10.5 __init__.py,1.4.10.7,1.4.10.8

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Thu, 29 May 2003 13:09:34 -0700


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

Modified Files:
      Tag: release22-maint
	Generator.py __init__.py 
Log Message:
Backport from 2.3 trunk:

    _make_boundary(): Fix for SF bug #745478, broken boundary calculation
    in some locales.  This code simplifies the boundary algorithm to use
    randint() which is what we wanted anyway.

    Bump package version to 2.5.3.


Index: Generator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v
retrieving revision 1.6.10.4
retrieving revision 1.6.10.5
diff -C2 -d -r1.6.10.4 -r1.6.10.5
*** Generator.py	21 Mar 2003 21:09:31 -0000	1.6.10.4
--- Generator.py	29 May 2003 20:09:30 -0000	1.6.10.5
***************
*** 6,9 ****
--- 6,10 ----
  
  import re
+ import sys
  import time
  import locale
***************
*** 357,365 ****
  
  # Helper
  def _make_boundary(text=None):
      # Craft a random boundary.  If text is given, ensure that the chosen
      # boundary doesn't appear in the text.
!     dp = locale.localeconv().get('decimal_point', '.')
!     boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '=='
      if text is None:
          return boundary
--- 358,369 ----
  
  # Helper
+ _width = len(repr(sys.maxint-1))
+ _fmt = '%%0%dd' % _width
+ 
  def _make_boundary(text=None):
      # Craft a random boundary.  If text is given, ensure that the chosen
      # boundary doesn't appear in the text.
!     token = random.randint(0, sys.maxint-1)
!     boundary = ('=' * 15) + (_fmt % token) + '=='
      if text is None:
          return boundary

Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v
retrieving revision 1.4.10.7
retrieving revision 1.4.10.8
diff -C2 -d -r1.4.10.7 -r1.4.10.8
*** __init__.py	8 May 2003 04:00:05 -0000	1.4.10.7
--- __init__.py	29 May 2003 20:09:31 -0000	1.4.10.8
***************
*** 5,9 ****
  """
  
! __version__ = '2.5.2'
  
  __all__ = [
--- 5,9 ----
  """
  
! __version__ = '2.5.3'
  
  __all__ = [