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,32 +45,22 @@ from zLOG import LOG
# 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.
import base64
global supported_decoding
supported_decoding = {}
import binascii
try:
# python v2.4 API
supported_decoding = {
'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
# "8bit", "7bit", and "binary" values all mean that NO encoding has been performed
, '8bit' : None
, '7bit' : None
, 'binary' : None
}
from base64 import decodestring as b64decode
except AttributeError:
# python v2.4 API
from base64 import b64decode
global supported_decoding
supported_decoding = {
'base64' : base64.b64decode
, 'quoted-printable': binascii.a2b_qp
# "8bit", "7bit", and "binary" values all mean that NO encoding has been performed
, '8bit' : None
, '7bit' : None
, 'binary' : None
}
class MailMessage(XMLObject, Event, CMFMailInMessage):
......
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