##// END OF EJS Templates
mail: ensure that Python2.4 to 2.7 use the same header format...
Nicolas Dumazet -
r11542:594b9884 stable
parent child Browse files
Show More
@@ -10,6 +10,26 import util, encoding
10 10 import os, smtplib, socket, quopri
11 11 import email.Header, email.MIMEText, email.Utils
12 12
13 _oldheaderinit = email.Header.Header.__init__
14 def _unifiedheaderinit(self, *args, **kw):
15 """
16 Python2.7 introduces a backwards incompatible change
17 (Python issue1974, r70772) in email.Generator.Generator code:
18 pre-2.7 code passed "continuation_ws='\t'" to the Header
19 constructor, and 2.7 removed this parameter.
20
21 Default argument is continuation_ws=' ', which means that the
22 behaviour is different in <2.7 and 2.7
23
24 We consider the 2.7 behaviour to be preferable, but need
25 to have an unified behaviour for versions 2.4 to 2.7
26 """
27 # override continuation_ws
28 kw['continuation_ws'] = ' '
29 _oldheaderinit(self, *args, **kw)
30
31 email.Header.Header.__dict__['__init__'] = _unifiedheaderinit
32
13 33 def _smtp(ui):
14 34 '''build an smtp connection and return a function to send mail'''
15 35 local_hostname = ui.config('smtp', 'local_hostname')
General Comments 0
You need to be logged in to leave comments. Login now