/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/mail_client.py

  • Committer: Jelmer Vernooij
  • Date: 2018-07-19 23:20:34 UTC
  • mto: (7045.3.3 python3-r)
  • mto: This revision was merged to the branch mainline in revision 7051.
  • Revision ID: jelmer@jelmer.uk-20180719232034-99vygokyxlac4cwy
Fix some mail client tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    registry,
34
34
    )
35
35
from .sixish import (
 
36
    PY3,
36
37
    text_type,
37
38
    )
38
39
 
235
236
        :param  u:  possible unicode string.
236
237
        :return:    encoded string if u is unicode, u itself otherwise.
237
238
        """
238
 
        if isinstance(u, text_type):
 
239
        if not PY3 and isinstance(u, text_type):
239
240
            return u.encode(osutils.get_user_encoding(), 'replace')
240
241
        return u
241
242
 
248
249
                        path itself otherwise.
249
250
        :raise:         UnableEncodePath.
250
251
        """
251
 
        if isinstance(path, text_type):
 
252
        if not PY3 and isinstance(path, text_type):
252
253
            try:
253
254
                return path.encode(osutils.get_user_encoding())
254
255
            except UnicodeEncodeError:
301
302
            # Store the temp file object in self, so that it does not get
302
303
            # garbage collected and delete the file before mutt can read it.
303
304
            self._temp_file = tempfile.NamedTemporaryFile(
304
 
                prefix="mutt-body-", suffix=".txt")
 
305
                prefix="mutt-body-", suffix=".txt", mode="w+")
305
306
            self._temp_file.write(body)
306
307
            self._temp_file.flush()
307
308
            message_options.extend(['-i', self._temp_file.name])
469
470
        after being read by Emacs.)
470
471
        """
471
472
 
472
 
        _defun = r"""(defun bzr-add-mime-att (file)
 
473
        _defun = br"""(defun bzr-add-mime-att (file)
473
474
  "Attach FILE to a mail buffer as a MIME attachment."
474
475
  (let ((agent mail-user-agent))
475
476
    (if (and file (file-exists-p file))