##// END OF EJS Templates
py3: use a BytesParser in notify extension...
Denis Laxalde -
r43634:ef81de93 stable
parent child Browse files
Show More
@@ -148,7 +148,6 b' web.baseurl'
148 from __future__ import absolute_import
148 from __future__ import absolute_import
149
149
150 import email.errors as emailerrors
150 import email.errors as emailerrors
151 import email.parser as emailparser
152 import fnmatch
151 import fnmatch
153 import hashlib
152 import hashlib
154 import socket
153 import socket
@@ -382,9 +381,8 b' class notifier(object):'
382 )
381 )
383 return
382 return
384
383
385 p = emailparser.Parser()
386 try:
384 try:
387 msg = p.parsestr(encoding.strfromlocal(data))
385 msg = mail.parsebytes(data)
388 except emailerrors.MessageParseError as inst:
386 except emailerrors.MessageParseError as inst:
389 raise error.Abort(inst)
387 raise error.Abort(inst)
390
388
@@ -440,6 +440,9 b' if pycompat.ispy3:'
440 finally:
440 finally:
441 fp.detach()
441 fp.detach()
442
442
443 def parsebytes(data):
444 ep = email.parser.BytesParser()
445 return ep.parsebytes(data)
443
446
444 else:
447 else:
445
448
@@ -449,6 +452,10 b' else:'
449 ep = email.parser.Parser()
452 ep = email.parser.Parser()
450 return ep.parse(fp)
453 return ep.parse(fp)
451
454
455 def parsebytes(data):
456 ep = email.parser.Parser()
457 return ep.parsestr(data)
458
452
459
453 def headdecode(s):
460 def headdecode(s):
454 '''Decodes RFC-2047 header'''
461 '''Decodes RFC-2047 header'''
General Comments 0
You need to be logged in to leave comments. Login now