def _authenticate(self):
        """If necessary authenticate yourself to the server."""
        auth = config.AuthenticationConfig()
        if self._smtp_username is None:
            # FIXME: Since _authenticate gets called even when no authentication
            # is necessary, it's not possible to use the default username 
            # here yet.
            self._smtp_username = auth.get_user('smtp', self._smtp_server)
            if self._smtp_username is None:
                return

        if self._smtp_password is None:
            self._smtp_password = auth.get_password(
                'smtp', self._smtp_server, self._smtp_username)

        # smtplib requires that the username and password be byte
        # strings.  The CRAM-MD5 spec doesn't give any guidance on
        # encodings, but the SASL PLAIN spec says UTF-8, so that's
        # what we'll use.
        username = osutils.safe_utf8(self._smtp_username)
        password = osutils.safe_utf8(self._smtp_password)

        self._connection.login(username, password)
예제 #2
0
    def _authenticate(self):
        """If necessary authenticate yourself to the server."""
        auth = config.AuthenticationConfig()
        if self._smtp_username is None:
            # FIXME: Since _authenticate gets called even when no authentication
            # is necessary, it's not possible to use the default username
            # here yet.
            self._smtp_username = auth.get_user('smtp', self._smtp_server)
            if self._smtp_username is None:
                return

        if self._smtp_password is None:
            self._smtp_password = auth.get_password('smtp', self._smtp_server,
                                                    self._smtp_username)

        # smtplib requires that the username and password be byte
        # strings.  The CRAM-MD5 spec doesn't give any guidance on
        # encodings, but the SASL PLAIN spec says UTF-8, so that's
        # what we'll use.
        username = osutils.safe_utf8(self._smtp_username)
        password = osutils.safe_utf8(self._smtp_password)

        self._connection.login(username, password)
예제 #3
0
 def fs2ftp(self, fspath):
     p = ftpserver.AbstractedFS.fs2ftp(self, osutils.safe_unicode(fspath))
     return osutils.safe_utf8(p)
예제 #4
0
 def listdir(self, path):
     """List the content of a directory."""
     return [osutils.safe_utf8(s) for s in os.listdir(path)]
예제 #5
0
 def fs2ftp(self, fspath):
     p = ftpserver.AbstractedFS.fs2ftp(self, osutils.safe_unicode(fspath))
     return osutils.safe_utf8(p)
예제 #6
0
 def listdir(self, path):
     """List the content of a directory."""
     return [osutils.safe_utf8(s) for s in os.listdir(path)]