mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Complete a merge of the mimelib project and the Python cvs codebases
for the email package. The former is now just a shell project that has some extra files for packaging for independent use (e.g. setup.py and README). Added a compatibility layer so that the same API can be used in Python 2.1 and 2.2/2.3 with the major differences shuffled off into helper modules (_compat21.py and _compat22.py). Also bumped the package version number to 2.0.3 for some fixes to be checked in momentarily.
This commit is contained in:
parent
2ae87539aa
commit
8c1aac2476
7 changed files with 168 additions and 45 deletions
|
|
@ -21,7 +21,24 @@ from rfc822 import mktime_tz
|
|||
from rfc822 import parsedate as _parsedate
|
||||
from rfc822 import parsedate_tz as _parsedate_tz
|
||||
|
||||
from quopri import decodestring as _qdecode
|
||||
try:
|
||||
from quopri import decodestring as _qdecode
|
||||
except ImportError:
|
||||
# Python 2.1 doesn't have quopri.decodestring()
|
||||
def _qdecode(s):
|
||||
import quopri as _quopri
|
||||
|
||||
if not s:
|
||||
return s
|
||||
hasnewline = (s[-1] == '\n')
|
||||
infp = StringIO(s)
|
||||
outfp = StringIO()
|
||||
_quopri.decode(infp, outfp)
|
||||
value = outfp.getvalue()
|
||||
if not hasnewline and value[-1] =='\n':
|
||||
return value[:-1]
|
||||
return value
|
||||
|
||||
import base64
|
||||
|
||||
# Intrapackage imports
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue