From caafd18fb9b659ff483e12cca21df2bd29b58ed6 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Sat, 20 Feb 2010 15:18:52 +0100 Subject: [PATCH] ubuntutools/lp/lpapicache.py: Re-add dropped "beta/" to the resource type URLs Use lookup_service_root() when checking for LP API URLs --- ubuntutools/lp/lpapicache.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index fbd807d..0ba5661 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -79,7 +79,7 @@ class BaseWrapper(object): resource_type = None # it's a base class after all def __new__(cls, data): - if isinstance(data, basestring) and data.startswith('https://api.edge.launchpad.net/beta/'): + if isinstance(data, basestring) and data.startswith(lookup_service_root(service) + 'beta/'): # looks like a LP API URL # check if it's already cached cached = cls._cache.get(data) @@ -134,7 +134,7 @@ class Distribution(BaseWrapper): ''' Wrapper class around a LP distribution object. ''' - resource_type = lookup_service_root(service) + '#distribution' + resource_type = lookup_service_root(service) + 'beta/#distribution' def __init__(self, *args): # Don't share _series and _archives between different Distributions @@ -216,14 +216,14 @@ class DistroSeries(BaseWrapper): ''' Wrapper class around a LP distro series object. ''' - resource_type = lookup_service_root(service) + '#distro_series' + resource_type = lookup_service_root(service) + 'beta/#distro_series' class Archive(BaseWrapper): ''' Wrapper class around a LP archive object. ''' - resource_type = lookup_service_root(service) + '#archive' + resource_type = lookup_service_root(service) + 'beta/#archive' def __init__(self, *args): # Don't share _srcpkgs between different Archives @@ -284,7 +284,7 @@ class SourcePackagePublishingHistory(BaseWrapper): ''' Wrapper class around a LP source package object. ''' - resource_type = lookup_service_root(service) + '#source_package_publishing_history' + resource_type = lookup_service_root(service) + 'beta/#source_package_publishing_history' def __init__(self, *args): # Don't share _builds between different SourcePackagePublishingHistory objects @@ -365,7 +365,10 @@ class PersonTeam(BaseWrapper): ''' Wrapper class around a LP person or team object. ''' - resource_type = (lookup_service_root(service) + '#person', lookup_service_root(service) + '#team') + resource_type = ( + lookup_service_root(service) + 'beta/#person', + lookup_service_root(service) + 'beta/#team', + ) _me = None # the PersonTeam object of the currently authenticated LP user @@ -468,7 +471,7 @@ class Build(BaseWrapper): ''' Wrapper class around a build object. ''' - resource_type = lookup_service_root(service) + '#build' + resource_type = lookup_service_root(service) + 'beta/#build' def __str__(self): return u'%s: %s' % (self.arch_tag, self.buildstate) @@ -490,4 +493,4 @@ class DistributionSourcePackage(BaseWrapper): ''' Caching class for distribution_source_package objects. ''' - resource_type = lookup_service_root(service) + '#distribution_source_package' + resource_type = lookup_service_root(service) + 'beta/#distribution_source_package'