keitaoouchi/easyimap

unicode() argument 2 must be string, not None

Closed this issue · 1 comments

Since 46597ec encode header. But second parameter from unicode is a string, not None

Example:

print message.title

Get error tot process unicode:

Traceback (most recent call last):
  File "/home/zikzakmedia/tryton/src/trytond/trytond/ir/cron.py", line 163, in _callback
    getattr(Model, cron.function)(*args)
  File "/home/zikzakmedia/tryton/src/getmail/getmail.py", line 243, in getmail_servers
    cls.get_server_emails(servers)
  File "/home/zikzakmedia/tryton/src/trytond/trytond/model/modelview.py", line 498, in wrapper
    return func(cls, *args, **kwargs)
  File "/home/zikzakmedia/tryton/src/getmail/getmail.py", line 218, in get_server_emails
    attachments=server.attachment)
  File "/home/zikzakmedia/tryton/src/helpdesk/helpdesk.py", line 555, in getmail
    msgsubject = message.title or 'Not subject'
  File "/home/zikzakmedia/tryton/local/lib/python2.7/site-packages/easyimap/easyimap.py", line 31, in title
    return _decode_header(self._message.get('Subject'))
  File "/home/zikzakmedia/tryton/local/lib/python2.7/site-packages/easyimap/easyimap.py", line 222, in _decode_header
    headers.append(unicode(decoded_str, encoding['encoding']))
TypeError: unicode() argument 2 must be string, not None

PR available Encode decode header/body when have encoding value #24