/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    urlutils,
33
33
    registry,
34
34
    )
35
 
from .sixish import (
36
 
    PY3,
37
 
    text_type,
38
 
    )
39
35
 
40
36
mail_client_registry = registry.Registry()
41
37
 
235
231
        :param  u:  possible unicode string.
236
232
        :return:    encoded string if u is unicode, u itself otherwise.
237
233
        """
238
 
        if not PY3 and isinstance(u, text_type):
239
 
            return u.encode(osutils.get_user_encoding(), 'replace')
240
234
        return u
241
235
 
242
236
    def _encode_path(self, path, kind):
248
242
                        path itself otherwise.
249
243
        :raise:         UnableEncodePath.
250
244
        """
251
 
        if not PY3 and isinstance(path, text_type):
252
 
            try:
253
 
                return path.encode(osutils.get_user_encoding())
254
 
            except UnicodeEncodeError:
255
 
                raise errors.UnableEncodePath(path, kind)
256
245
        return path
257
246
 
258
247