~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-07 14:03:52 UTC
  • mto: This revision was merged to the branch mainline in revision 4284.
  • Revision ID: jelmer@samba.org-20090407140352-0u5q1uqfbltf6b03
Avoid using the default username in the case of SMTP.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1127
1127
        self._save()
1128
1128
 
1129
1129
    def get_user(self, scheme, host, port=None, realm=None, path=None, 
1130
 
                 prompt=None, ask=False):
 
1130
                 prompt=None, ask=False, default=None):
1131
1131
        """Get a user from authentication file.
1132
1132
 
1133
1133
        :param scheme: protocol
1163
1163
                    prompt_host = host
1164
1164
                user = ui.ui_factory.get_username(prompt, host=prompt_host)
1165
1165
            else:
1166
 
                import getpass
1167
 
                user = getpass.getuser()
 
1166
                if default is None:
 
1167
                    import getpass
 
1168
                    default = getpass.getuser()
 
1169
                user = default
1168
1170
        return user
1169
1171
 
1170
1172
    def get_password(self, scheme, host, user, port=None,