ubuntutools/lp/libsupport.py: Support production API URLs in

translate_web_api.
This commit is contained in:
Stefano Rivera 2010-09-22 11:41:58 +02:00
parent e55766b0d9
commit a2a4fc785d
2 changed files with 6 additions and 2 deletions

2
debian/changelog vendored
View File

@ -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 <bdrung@ubuntu.com> Tue, 21 Sep 2010 23:52:46 +0200

View File

@ -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]