Bug in launchpad plugin

John Arbash Meinel john at arbash-meinel.com
Tue Nov 13 20:20:38 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just tried to use 'bzr register-branch' and it seems one of the recent
updates broke the plugin.

Specifically, the code is doing this:

    def gather_user_credentials(self):
        """Get the password from the user."""
        config = config.GlobalConfig()
        self.registrant_email = config.user_email()
        if self.registrant_password is None:
            auth = config.AuthenticationConfig()
            scheme, hostinfo = urlsplit(self.service_url)[:2]
            prompt = 'launchpad.net password for %s: ' % \
                    self.registrant_email
            # We will reuse http[s] credentials if we can, prompt user
            # otherwise
            self.registrant_password = auth.get_password(scheme, hostinfo,
                                                         prompt=prompt)

However, that 'config = ...' is forcing a local variable named 'config' to
exist. Which hides the global variable 'config' which is the config.py module.

Annotate blames Vincent's recent AuthenticationConfig changes. The simple fix
is to just use

the_config = config.GlobalConfig()
self.registrant_email = the_config.user_email()

I'm a little curious how this slipped through. Is 'gather_user_credentials()'
not tested?

  affects bzr
  importance medium
  status triaged
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHOgcWJdeBCYSNAAMRAuosAKCLog38uPfRx2r/Y135RqRsb2OswwCcCiZ0
oFD5FfLuUCq+RI7MVoFwPiA=
=LWtq
-----END PGP SIGNATURE-----



More information about the bazaar mailing list