comparison roundup/rfc2822.py @ 2005:fc52d57c6c3e

documentation cleanup
author Richard Jones <richard@users.sourceforge.net>
date Wed, 11 Feb 2004 23:55:10 +0000
parents ea1afeb64b45
children be047db3dd3d
comparison
equal deleted inserted replaced
2004:1782fe36e7b8 2005:fc52d57c6c3e
1 """Some rfc822 functions taken from the new (python2.3) "email" module.
2 """
3 __docformat__ = 'restructuredtext'
4
1 import re 5 import re
2 from string import letters, digits 6 from string import letters, digits
3 from binascii import b2a_base64, a2b_base64 7 from binascii import b2a_base64, a2b_base64
4 8
5 ecre = re.compile(r''' 9 ecre = re.compile(r'''
35 if convert_eols: 39 if convert_eols:
36 return dec.replace(CRLF, convert_eols) 40 return dec.replace(CRLF, convert_eols)
37 return dec 41 return dec
38 42
39 def unquote_match(match): 43 def unquote_match(match):
40 """Turn a match in the form =AB to the ASCII character with value 0xab 44 """Turn a match in the form ``=AB`` to the ASCII character with value
45 0xab.
41 46
42 Taken from 'email' module 47 Taken from 'email' module
43 """ 48 """
44 s = match.group(0) 49 s = match.group(0)
45 return chr(int(s[1:3], 16)) 50 return chr(int(s[1:3], 16))
46 51
47 def qp_decode(s): 52 def qp_decode(s):
48 """Decode a string encoded with RFC 2045 MIME header `Q' encoding. 53 """Decode a string encoded with RFC 2045 MIME header 'Q' encoding.
49 54
50 This function does not parse a full MIME header value encoded with 55 This function does not parse a full MIME header value encoded with
51 quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use 56 quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
52 the high level email.Header class for that functionality. 57 the high level email.Header class for that functionality.
53 58

Roundup Issue Tracker: http://roundup-tracker.org/