~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
than once for each place that needs to take it into account.
21
21
"""
22
22
 
 
23
from __future__ import absolute_import
 
24
 
23
25
from bzrlib import (
24
26
    errors,
25
27
    trace,
26
28
    transport,
27
29
    )
28
 
from bzrlib.config import AuthenticationConfig, GlobalConfig
29
 
 
 
30
from bzrlib.config import AuthenticationConfig, GlobalStack
 
31
from bzrlib.i18n import gettext
30
32
 
31
33
LAUNCHPAD_BASE = 'https://launchpad.net/'
32
34
 
53
55
        disagree about username.
54
56
    """
55
57
    if _config is None:
56
 
        _config = GlobalConfig()
 
58
        _config = GlobalStack()
57
59
 
58
 
    username = _config.get_user_option('launchpad_username')
 
60
    username = _config.get('launchpad_username')
59
61
    if username is not None:
60
62
        auth = AuthenticationConfig()
61
63
        auth_username = _get_auth_user(auth)
62
64
        # Auto-upgrading
63
65
        if auth_username is None:
64
 
            trace.note('Setting ssh/sftp usernames for launchpad.net.')
 
66
            trace.note(gettext('Setting ssh/sftp usernames for launchpad.net.'))
65
67
            _set_auth_user(username, auth)
66
68
        elif auth_username != username:
67
69
            raise MismatchedUsernames()
70
72
 
71
73
def _set_global_option(username, _config=None):
72
74
    if _config is None:
73
 
        _config = GlobalConfig()
74
 
    _config.set_user_option('launchpad_username', username)
 
75
        _config = GlobalStack()
 
76
    _config.set('launchpad_username', username)
75
77
 
76
78
 
77
79
def set_lp_login(username, _config=None):