コード例 #1
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)
コード例 #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
ファイル: pyftpdlib_based.py プロジェクト: Distrotech/bzr
 def fs2ftp(self, fspath):
     p = ftpserver.AbstractedFS.fs2ftp(self, osutils.safe_unicode(fspath))
     return osutils.safe_utf8(p)
コード例 #4
0
ファイル: pyftpdlib_based.py プロジェクト: Distrotech/bzr
 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)]