[Python-checkins] python/dist/src/Lib/email Generator.py,1.17,1.17.6.1

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Mon, 03 Mar 2003 07:48:15 -0800


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

Modified Files:
      Tag: folding-reimpl-branch
	Generator.py 
Log Message:
_make_boundary(): Some locales don't use periods as th decimal point
character.  SF patch #652497 by Dmitry Azhichakov (slightly modified
by Barry).


Index: Generator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v
retrieving revision 1.17
retrieving revision 1.17.6.1
diff -C2 -d -r1.17 -r1.17.6.1
*** Generator.py	14 Oct 2002 15:09:30 -0000	1.17
--- Generator.py	3 Mar 2003 15:48:08 -0000	1.17.6.1
***************
*** 5,10 ****
  """
  
- import time
  import re
  import random
  
--- 5,11 ----
  """
  
  import re
+ import time
+ import locale
  import random
  
***************
*** 365,369 ****
      # Craft a random boundary.  If text is given, ensure that the chosen
      # boundary doesn't appear in the text.
!     boundary = ('=' * 15) + repr(random.random()).split('.')[1] + '=='
      if text is None:
          return boundary
--- 366,371 ----
      # 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