~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smtp_connection.py

  • Committer: Vincent Ladeuil
  • Date: 2007-10-22 15:18:24 UTC
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071022151824-eol757lk393ofc38
AuthenticationConfig can be queried for logins too (first step).

* bzrlib/transport/ssh.py:
(_paramiko_auth): Try to get a user from AuthenticationConfig.

* bzrlib/smtp_connection.py:
(SMTPConnection._authenticate): Try to get a user from
AuthenticationConfig.

* bzrlib/transport/ftp.py:
(FtpTransport._create_connection): Try to get a user from
AuthenticationConfig. Credentials are now (user, password) instead
of just password.

* bzrlib/tests/test_ftp_transport.py:
(TestFTPServerUI._add_authorized_user): Cleanup by refactoring.

* bzrlib/config.py:
(AuthenticationConfig.get_user): New method to get logins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
 
90
90
    def _authenticate(self):
91
91
        """If necessary authenticate yourself to the server."""
 
92
        auth = config.AuthenticationConfig()
92
93
        if self._smtp_username is None:
93
 
            return
 
94
            self._smtp_username = auth.get_user('smtp', self._smtp_server)
 
95
            if self._smtp_username is None:
 
96
                return
94
97
 
95
98
        if self._smtp_password is None:
96
 
            auth = config.AuthenticationConfig()
97
99
            self._smtp_password = auth.get_password(
98
100
                'smtp', self._smtp_server, self._smtp_username)
99
101