[nagging as lifeless and Larstiq told me to] get_password with or without a prompt to address bug 72792

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Mar 15 22:59:24 GMT 2007


>>>>> "john" == John Arbash Meinel <john at arbash-meinel.com> writes:

    john> John Arbash Meinel has voted +1.
    john> Status is now: Semi-approved
    john> Comment:
    john> I happy enough with this.

    john> I do thing we want to end up with a

    john> get_password(user='x', host='y') and get rid of the 'prompt=' variable.

I may have to rethink about how I wanted to address bug #72792.

The idea was that if the http server replies with a 401
Unauthorized, bzr may request a username and a password.

Another approach may be to *require* the username in the url so
that we don't need get_login anymore.

This approach will be more in line with the other transports
which do not (or cannot) handle changing the username.  And
anyway, as the username is required to connect, typing it in the
url provides the additional benefits that the right url will be
recorded in locations.conf or branch/parent, those avoiding
typing the username at each use.

In that case the 401 handling will issue a 'Authorization
required, use user at host syntax in your url' message to the user
and just abort.

Thoughts ?

Additionally to the host, http may specify a realm.

In the existing code we have:

- ssh/ftp/sftp: host fixed, user fixed, password typed
  prompt='SSH %(user)s@%(host)s password'
  prompt='FTP %(user)s@%(host)s password',

- http/https: host fixed, realm fixed, user fixed, password typed.
  prompt='HTTP %(user)s@%(host)s password'

So I'll go with:

get_password(prompt, scheme, host, user, realm=None)

with a default value of prompt:
%(scheme)s %(user)s@%(host)s  %(realm)s password'

with realm='for realm (blabla)' or empty if no realm is
required.

And I keep the idea of letting the other GUI change the prompt if
they desire.

Thoughts ?

         Vincent



More information about the bazaar mailing list