/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: Martin
  • Date: 2010-05-25 17:27:52 UTC
  • mfrom: (5254 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5257.
  • Revision ID: gzlist@googlemail.com-20100525172752-amm089xcikv968sw
Merge bzr.dev to unite with similar changes already made

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
17
17
 
18
18
"""Directory lookup that uses Launchpad."""
19
19
 
20
 
from urlparse import urlsplit, urlunsplit
 
20
from urlparse import urlsplit
21
21
import xmlrpclib
22
22
 
23
23
from bzrlib import (
24
24
    debug,
25
25
    errors,
26
26
    trace,
27
 
    urlutils,
28
27
    )
29
28
from bzrlib.transport import (
30
29
    get_transport,
63
62
                 _request_factory=ResolveLaunchpadPathRequest,
64
63
                 _lp_login=None):
65
64
        """Resolve the base URL for this transport."""
 
65
        service = LaunchpadService.for_url(url)
66
66
        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
67
        resolve = _request_factory(result[2].strip('/'))
74
 
        service = LaunchpadService(lp_instance=lp_instance)
75
68
        try:
76
69
            result = resolve.submit(service)
77
70
        except xmlrpclib.Fault, fault:
79
72
                path=url, extra=fault.faultString)
80
73
 
81
74
        if 'launchpad' in debug.debug_flags:
82
 
            trace.mutter("resolve_lp_path(%r) == %r", path, result)
 
75
            trace.mutter("resolve_lp_path(%r) == %r", url, result)
83
76
 
84
77
        if _lp_login is None:
85
78
            _lp_login = get_lp_login()