/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_api.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-17 06:26:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5617.
  • Revision ID: jelmer@samba.org-20110117062635-wfw8z8dq2zve2b5e
Support the 'qastaging' instance of Launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    from launchpadlib.uris import LPNET_SERVICE_ROOT
52
52
except ImportError:
53
53
    LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'
 
54
try:
 
55
    from launchpadlib.uris import QASTAGING_SERVICE_ROOT
 
56
except ImportError:
 
57
    QASTAGING_SERVICE_ROOT = 'https://api.qastaging.launchpad.net/'
54
58
 
55
59
 
56
60
# Declare the minimum version of launchpadlib that we need in order to work.
80
84
 
81
85
LAUNCHPAD_API_URLS = {
82
86
    'production': LPNET_SERVICE_ROOT,
 
87
    'qastaging': QASTAGING_SERVICE_ROOT,
83
88
    'staging': STAGING_SERVICE_ROOT,
84
89
    'dev': 'https://api.launchpad.dev/beta/',
85
90
    }
189
194
    @staticmethod
190
195
    def tweak_url(url, launchpad):
191
196
        """Adjust a URL to work with staging, if needed."""
192
 
        if str(launchpad._root_uri) != STAGING_SERVICE_ROOT:
193
 
            return url
194
 
        if url is None:
195
 
            return None
196
 
        return url.replace('bazaar.launchpad.net',
197
 
                           'bazaar.staging.launchpad.net')
 
197
        if str(launchpad._root_uri) == STAGING_SERVICE_ROOT:
 
198
            return url.replace('bazaar.launchpad.net',
 
199
                               'bazaar.staging.launchpad.net')
 
200
        elif str(launchpad._root_uri) == QASTAGING_SERVICE_ROOT:
 
201
            return url.replace('bazaar.launchpad.net',
 
202
                               'bazaar.qastaging.launchpad.net')
 
203
        return url
198
204
 
199
205
    @classmethod
200
206
    def from_bzr(cls, launchpad, bzr_branch, create_missing=True):