security issues.
-# Copyright (C) 2001-2007 Python Software Foundation
-# Author: email-sig@python.org
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: che@debian.org (Ben Gertzfield), barry@python.org (Barry Warsaw)
from types import UnicodeType
from email.Encoders import encode_7or8bit
# of stability and useability.
CODEC_MAP = {
- 'gb2312': 'eucgb2312_cn',
+ 'gb2132': 'eucgb2312_cn',
'big5': 'big5_tw',
'utf-8': 'utf-8',
# Hack: We don't want *any* conversion for stuff marked us-ascii, as all
-# Copyright (C) 2001-2007 Python Software Foundation
-# Author: email-sig@python.org
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: barry@python.org (Barry Warsaw)
"""A package for parsing, handling, and generating email messages."""
-__version__ = '2.5.9'
+__version__ = '2.5.8'
__all__ = [
'base64MIME',
self._file = open(self._backupfilename, "r")
try:
perm = os.fstat(self._file.fileno()).st_mode
- except (AttributeError, OSError):
- # AttributeError occurs in Jython, where there's no
- # os.fstat.
+ except OSError:
self._output = open(self._filename, "w")
else:
fd = os.open(self._filename,
class SHATestCase(unittest.TestCase):
def check(self, data, digest):
- # Check digest matches the expected value
- obj = sha.new(data)
- computed = obj.hexdigest()
+ computed = sha.new(data).hexdigest()
self.assert_(computed == digest)
- # Verify that the value doesn't change between two consecutive
- # digest operations.
- computed_again = obj.hexdigest()
- self.assert_(computed == computed_again)
-
- # Check hexdigest() output matches digest()'s output
- digest = obj.digest()
- hexd = ""
- for c in digest:
- hexd += '%02x' % ord(c)
- self.assert_(computed == hexd)
-
def test_case_1(self):
self.check("abc",
"a9993e364706816aba3e25717850c26c9cd0d89d")
self.check("a" * 1000000,
"34aa973cd4c4daa4f61eeb2bdbad27316534016f")
- def test_case_4(self):
- self.check(chr(0xAA) * 80,
- '4ca0ef38f1794b28a8f8ee110ee79d48ce13be25')
def test_main():
test_support.run_unittest(SHATestCase)
#
# Open the output file
#
- opened = False
if out_file == '-':
out_file = sys.stdout
elif isinstance(out_file, StringType):
except AttributeError:
pass
out_file = fp
- opened = True
#
# Main decoding loop
#
s = in_file.readline()
if not s:
raise Error, 'Truncated input file'
- if opened:
- out_file.close()
def test():
"""uuencode/uudecode main program"""