Roundup Tracker - Issues

Message6967

Author ced
Recipients ced
Date 2020-10-08.14:51:35
Message-id <1602168696.54.0.366137933362.issue2551092@roundup.psfhosted.org>
In-reply-to
I got this traceback on email with subject encoding Q:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1511, in handle_Message
    return self.handle_message(message)
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1583, in handle_message
    return self._handle_message(message)
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1594, in _handle_message
    self.parsed_message = self.parsed_message_class(self, message)
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 509, in __init__
    self.subject = message.get_header('subject', '')
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 252, in get_header
    return self._decode_header(value.replace('\n', ''))
  File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 219, in _decode_header
    for part, encoding in decode_header(hdr):
  File "/usr/lib/python3.7/site-packages/roundup/anypy/email_.py", line 124, in decode_header
    last_word += word
TypeError: can only concatenate str (not "bytes") to str


I found that the roundup.anypy.email_.decode_header which is a copy of the stdlib email.header.decode_header is missing a line which convert word into bytes if it is a str (on Python3).
Here is attached a patch which applies the change only for Python3.
Also I think the fix of issue2551008 may be removed as now decode_header will always returns bytes.
It will even better to remove roundup.anypy.email_ completly once Python2 is no more supported (issue2550879).
History
Date User Action Args
2020-10-08 14:51:36cedsetrecipients: + ced
2020-10-08 14:51:36cedsetmessageid: <1602168696.54.0.366137933362.issue2551092@roundup.psfhosted.org>
2020-10-08 14:51:36cedlinkissue2551092 messages
2020-10-08 14:51:36cedcreate