From d63b782aec1a819b4f2c99bb5a74ae07eea5e420 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Wed, 22 Jul 2009 11:54:31 +0200 Subject: [PATCH] * lpapiwrapper.py: - Add a check for cached LP API URLs instead of blindly fetching it --- ubuntutools/lp/lpapiwrapper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ubuntutools/lp/lpapiwrapper.py b/ubuntutools/lp/lpapiwrapper.py index ee8798b..a27107a 100644 --- a/ubuntutools/lp/lpapiwrapper.py +++ b/ubuntutools/lp/lpapiwrapper.py @@ -251,7 +251,13 @@ class BaseWrapper(object): def __new__(cls, data): if isinstance(data, str) and data.startswith('https://api.edge.launchpad.net/beta/'): - # looks like a LP API URL, try to get it + # looks like a LP API URL + # check if it's already cached + cached = cls._cache.get(data) + if cached: + return cached + + # not cached, so try to get it try: data = Launchpad.load(data) except HTTPError: