[MERGE] Add get_username() call to the UIFactory.

Jelmer Vernooij jelmer at samba.org
Wed Apr 1 20:41:33 BST 2009


Gary van der Merwe wrote:
> bb:coment
> 
> +    def get_username(self, prompt, **kwargs):
> +        """Prompt the user for a password.
> 
> Should that not be :
> 
> +    def get_username(self, prompt, **kwargs):
> +        """Prompt the user for a user name.
> 
> 
> Typical, GUI's will ask for a user name and password with one dialog
> box. I'm not sure how one would implement that with this api. I guess
> that you could show a dialog that asks for a user name and password
> when get_username is called, store the password, and return that
> password when get_password is called. But how would you safely match
> get_username and get_password calls. It would be much easier if you
> had a method for both user name and password. E.g.:
> 
> +    def get_username_password(self, prompt, **kwargs):
> +        """Prompt the user for a username and password.
> ...
> +        :return:(username, password), return None if the user
> +                 canceled the request.
It might be useful to have something like that *in addition* to the
current API, since there are also situations in which we have to ask for
just one of the two (Kerberos or SSH authentication requires just the
username, if the username is known we can ask just for the password).

In other words, I agree that would be a nice thing to support asking for
both at the same time but I think that's a different patch.

Cheers,

Jelmer



More information about the bazaar mailing list