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.
Backport candidate for Python 2.2.3
"""
import re
+import sys
import time
import locale
import random
\f
# 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.
- dp = locale.localeconv().get('decimal_point', '.')
- boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '=='
+ token = random.randint(0, sys.maxint-1)
+ boundary = ('=' * 15) + (_fmt % token) + '=='
if text is None:
return boundary
b = boundary
"""A package for parsing, handling, and generating email messages.
"""
-__version__ = '2.5.2'
+__version__ = '2.5.3'
__all__ = [
'base64MIME',