~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-07-29 10:44:42 UTC
  • mfrom: (5361.1.1 2.3-lp-home)
  • Revision ID: pqm@pqm.ubuntu.com-20100729104442-5g1m4pumcss037ic
(spiv) Expand lp:~/ to lp:~username/ if a user has already logged in. (John
 A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
        """Resolve the base URL for this transport."""
65
65
        service = LaunchpadService.for_url(url)
66
66
        result = urlsplit(url)
67
 
        resolve = _request_factory(result[2].strip('/'))
 
67
        if _lp_login is None:
 
68
            _lp_login = get_lp_login()
 
69
        path = result[2].strip('/')
 
70
        if path.startswith('~/'):
 
71
            if _lp_login is None:
 
72
                raise errors.InvalidURL(path=url,
 
73
                    extra='Cannot resolve "~" to your username.'
 
74
                          ' See "bzr help launchpad-login"')
 
75
            path = '~' + _lp_login + path[1:]
 
76
        resolve = _request_factory(path)
68
77
        try:
69
78
            result = resolve.submit(service)
70
79
        except xmlrpclib.Fault, fault:
74
83
        if 'launchpad' in debug.debug_flags:
75
84
            trace.mutter("resolve_lp_path(%r) == %r", url, result)
76
85
 
77
 
        if _lp_login is None:
78
 
            _lp_login = get_lp_login()
79
86
        _warned_login = False
80
87
        for url in result['urls']:
81
88
            scheme, netloc, path, query, fragment = urlsplit(url)