Commit a8092373 authored by Kevin Deldycke's avatar Kevin Deldycke

Add support of quoted-printable encoding for python 2.4

Reduce the code complexity

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6435 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e8181fa1
...@@ -45,26 +45,16 @@ from zLOG import LOG ...@@ -45,26 +45,16 @@ from zLOG import LOG
# Support mail decoding in both python v2.3 and v2.4. # Support mail decoding in both python v2.3 and v2.4.
# See http://www.freesoft.org/CIE/RFC/1521/5.htm for 'content-transfer-encoding' explaination. # See http://www.freesoft.org/CIE/RFC/1521/5.htm for 'content-transfer-encoding' explaination.
import base64 import binascii
global supported_decoding
supported_decoding = {}
try: try:
# python v2.3 API
from base64 import decodestring as b64decode
except AttributeError:
# python v2.4 API # python v2.4 API
supported_decoding = { from base64 import b64decode
global supported_decoding
supported_decoding = {
'base64' : base64.b64decode 'base64' : base64.b64decode
, 'base32' : base64.b32decode
, 'base16' : base64.b16decode
# , 'quoted-printable': None
# "8bit", "7bit", and "binary" values all mean that NO encoding has been performed
, '8bit' : None
, '7bit' : None
, 'binary' : None
}
except AttributeError:
# python v2.3 API
import binascii
supported_decoding = {
'base64' : base64.decodestring
, 'quoted-printable': binascii.a2b_qp , 'quoted-printable': binascii.a2b_qp
# "8bit", "7bit", and "binary" values all mean that NO encoding has been performed # "8bit", "7bit", and "binary" values all mean that NO encoding has been performed
, '8bit' : None , '8bit' : None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment