/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-04-13 04:33:55 UTC
  • mfrom: (5147 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5149.
  • Revision ID: andrew.bennetts@canonical.com-20100413043355-lg3id0uwtju0k3zs
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Directory lookup that uses Launchpad."""
63
63
                 _request_factory=ResolveLaunchpadPathRequest,
64
64
                 _lp_login=None):
65
65
        """Resolve the base URL for this transport."""
 
66
        service = LaunchpadService.for_url(url)
66
67
        result = urlsplit(url)
67
 
        # Perform an XMLRPC request to resolve the path
68
 
        lp_instance = result[1]
69
 
        if lp_instance == '':
70
 
            lp_instance = None
71
 
        elif lp_instance not in LaunchpadService.LAUNCHPAD_INSTANCE:
72
 
            raise errors.InvalidURL(path=url)
73
68
        resolve = _request_factory(result[2].strip('/'))
74
 
        service = LaunchpadService(lp_instance=lp_instance)
75
69
        try:
76
70
            result = resolve.submit(service)
77
71
        except xmlrpclib.Fault, fault:
79
73
                path=url, extra=fault.faultString)
80
74
 
81
75
        if 'launchpad' in debug.debug_flags:
82
 
            trace.mutter("resolve_lp_path(%r) == %r", path, result)
 
76
            trace.mutter("resolve_lp_path(%r) == %r", url, result)
83
77
 
84
78
        if _lp_login is None:
85
79
            _lp_login = get_lp_login()
90
84
                                              fragment):
91
85
                # Only accept launchpad.net bzr+ssh URLs if we know
92
86
                # the user's Launchpad login:
 
87
                if _lp_login is not None:
 
88
                    break
93
89
                if _lp_login is None:
94
90
                    if not _warned_login:
95
 
                        trace.warning('You have not informed bzr of your '
96
 
                                'launchpad login. If you are attempting a\n'
97
 
                                'write operation and it fails, run '
98
 
                                '"bzr launchpad-login YOUR_ID" and try again.')
 
91
                        trace.warning(
 
92
'You have not informed bzr of your Launchpad ID, and you must do this to\n'
 
93
'write to Launchpad or access private data.  See "bzr help launchpad-login".')
99
94
                        _warned_login = True
100
 
                    continue
101
 
                url = urlunsplit((scheme, '%s@%s' % (_lp_login, netloc),
102
 
                                  path, query, fragment))
103
 
                break
104
95
            else:
105
96
                # Use the URL if we can create a transport for it.
106
97
                try: