From a2a4fc785ddf0ac750b6f54c574bd91d092e2e30 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Wed, 22 Sep 2010 11:41:58 +0200 Subject: [PATCH] ubuntutools/lp/libsupport.py: Support production API URLs in translate_web_api. --- debian/changelog | 2 ++ ubuntutools/lp/libsupport.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2683398..125801d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,8 @@ ubuntu-dev-tools (0.103) UNRELEASED; urgency=low * Add manpages for sponsor-patch and import-bug-from-debian. * hugdaylist, manage-credentials, massfile, merge-changelog, ubuntutools/requestsync/common.py: Some pyflakes-induced cleanup. + * ubuntutools/lp/libsupport.py: Support production API URLs in + translate_web_api. -- Benjamin Drung Tue, 21 Sep 2010 23:52:46 +0200 diff --git a/ubuntutools/lp/libsupport.py b/ubuntutools/lp/libsupport.py index 36fb856..b10d663 100644 --- a/ubuntutools/lp/libsupport.py +++ b/ubuntutools/lp/libsupport.py @@ -92,8 +92,10 @@ def query_to_dict(query_string): def translate_web_api(url, launchpad): scheme, netloc, path, query, fragment = urlparse.urlsplit(url) query = query_to_dict(query) - if not (("edge" in netloc and "edge" in str(launchpad._root_uri)) - or ("staging" in netloc and "staging" in str(launchpad._root_uri))): + + differences = set(netloc.split('.')).symmetric_difference( + set(launchpad._root_uri.host.split('.'))) + if ('staging' in differences or 'edge' in differences): raise ValueError("url conflict (url: %s, root: %s" %(url, launchpad._root_uri)) if path.endswith("/+bugs"): path = path[:-6]