~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/lp_registration.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-04 18:51:39 UTC
  • mfrom: (2961.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20071104185139-kaio3sneodg2kp71
Authentication ring implementation (read-only)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import urllib
22
22
import xmlrpclib
23
23
 
24
 
import bzrlib.config
25
 
import bzrlib.errors as errors
 
24
from bzrlib import (
 
25
    config,
 
26
    errors,
 
27
    __version__ as _bzrlib_version,
 
28
    )
26
29
 
27
30
# for testing, do
28
31
'''
53
56
            else:
54
57
                transport = xmlrpclib.Transport()
55
58
            transport.user_agent = 'bzr/%s (xmlrpclib/%s)' \
56
 
                    % (bzrlib.__version__, xmlrpclib.__version__)
 
59
                    % (_bzrlib_version, xmlrpclib.__version__)
57
60
        self.transport = transport
58
61
 
59
62
 
92
95
 
93
96
    def gather_user_credentials(self):
94
97
        """Get the password from the user."""
95
 
        config = bzrlib.config.GlobalConfig()
 
98
        config = config.GlobalConfig()
96
99
        self.registrant_email = config.user_email()
97
100
        if self.registrant_password is None:
 
101
            auth = config.AuthenticationConfig()
 
102
            scheme, hostinfo = urlsplit(self.service_url)[:2]
98
103
            prompt = 'launchpad.net password for %s: ' % \
99
104
                    self.registrant_email
100
 
            self.registrant_password = getpass(prompt)
 
105
            # We will reuse http[s] credentials if we can, prompt user
 
106
            # otherwise
 
107
            self.registrant_password = auth.get_password(scheme, hostinfo,
 
108
                                                         prompt=prompt)
101
109
 
102
110
    def send_request(self, method_name, method_params):
103
111
        proxy = self.get_proxy()