/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 bzrlib/smtp_connection.py

  • Committer: James Henstridge
  • Date: 2009-03-25 05:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 4203.
  • Revision ID: james@jamesh.id.au-20090325054124-y7v92dpwnhh28szg
Switch to using osutils.safe_utf8() as suggested by Vincent.  Also 
remove a few unused imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
    config,
26
 
    ui,
 
26
    osutils,
27
27
    )
28
28
from bzrlib.errors import (
29
29
    NoDestinationAddress,
113
113
 
114
114
        # smtplib requires that the username and password be byte
115
115
        # strings.  The CRAM-MD5 spec doesn't give any guidance on
116
 
        # encodings, but the SASL PLAIN says UTF-8, so that's what
117
 
        # we'll use.
118
 
        if isinstance(self._smtp_username, unicode):
119
 
            self._smtp_username = self._smtp_username.encode('utf-8')
120
 
        if isinstance(self._smtp_password, unicode):
121
 
            self._smtp_password = self._smtp_password.encode('utf-8')
 
116
        # encodings, but the SASL PLAIN spec says UTF-8, so that's
 
117
        # what we'll use.
 
118
        username = osutils.safe_utf8(self._smtp_username)
 
119
        password = osutils.safe_utf8(self._smtp_password)
122
120
 
123
 
        self._connection.login(self._smtp_username, self._smtp_password)
 
121
        self._connection.login(username, password)
124
122
 
125
123
    @staticmethod
126
124
    def get_message_addresses(message):