[Checkins] [zopefoundation/zope.sendmail] d1fb3c: Fix text/bytes issue in MailDir for Python 3 (#24)

Michael Howitz noreply at github.com
Wed Apr 3 12:01:45 CEST 2019


  Branch: refs/heads/master
  Home:   https://github.com/zopefoundation/zope.sendmail
  Commit: d1fb3c7baa5f1f48d0d0ae217e2f2777fa16d85d
      https://github.com/zopefoundation/zope.sendmail/commit/d1fb3c7baa5f1f48d0d0ae217e2f2777fa16d85d
  Author: Michael Howitz <mh at gocept.com>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M CHANGES.rst
    M src/zope/sendmail/maildir.py
    M src/zope/sendmail/tests/test_maildir.py

  Log Message:
  -----------
  Fix text/bytes issue in MailDir for Python 3 (#24)

* `Maildir.newMessage` returns a MaildirMessageWriter with a file handle opened
in text mode, see
https://github.com/zopefoundation/zope.sendmail/blob/2ee8b0a454ff484335e6b65b9d46a695309a2b2f/src/zope/sendmail/maildir.py#L110
(mode is 'w' not 'wb')

But `MaildirMessageWriter.write` writes bytes to this file handle, see
https://github.com/zopefoundation/zope.sendmail/blob/2ee8b0a454ff484335e6b65b9d46a695309a2b2f/src/zope/sendmail/maildir.py#L131-L132

This commit changes the implementation to use bytes for Python 3.

The change is necessary to get the tests in zopefoundation/Products.MailHost#15 green.




More information about the checkins mailing list