From fe63eaec0565b7c8cd41d655cc61d0927b97150d Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Mon, 28 Feb 2011 23:56:09 +0200 Subject: [PATCH] * Remove ubuntutools.lp.libsupport.approve_application, no longer used. --- debian/changelog | 5 +++-- ubuntutools/lp/libsupport.py | 36 ------------------------------------ 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/debian/changelog b/debian/changelog index 23bda80..c0f6020 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,9 +4,10 @@ ubuntu-dev-tools (0.119) UNRELEASED; urgency=low * Remove manage-credentials, and credential handling code from ubuntutools.lp.libsupport. Launchpadlib 1.9 handles this via python-keyring. (LP: #387297, #645629, #689100) - * Remove ubuntutools.lp.libsupporttranslate_api_web, no longer used. + * Remove ubuntutools.lp.libsupport.translate_api_web, no longer used. + * Remove ubuntutools.lp.libsupport.approve_application, no longer used. - -- Stefano Rivera Sun, 27 Feb 2011 23:07:06 +0200 + -- Stefano Rivera Mon, 28 Feb 2011 23:55:25 +0200 ubuntu-dev-tools (0.118) unstable; urgency=low diff --git a/ubuntutools/lp/libsupport.py b/ubuntutools/lp/libsupport.py index 5988144..c35899d 100644 --- a/ubuntutools/lp/libsupport.py +++ b/ubuntutools/lp/libsupport.py @@ -61,39 +61,3 @@ def translate_web_api(url, launchpad): url = urlparse.urlunsplit((scheme, netloc, api_path + path.lstrip("/"), query, fragment)) return url - -LEVEL = { - 0: "UNAUTHORIZED", - 1: "READ_PUBLIC", - 2: "WRITE_PUBLIC", - 3: "READ_PRIVATE", - 4: "WRITE_PRIVATE" -} - -def approve_application(credentials, email, password, level, web_root, - context): - authorization_url = credentials.get_request_token(context, web_root) - if level in LEVEL: - level = 'field.actions.%s' % LEVEL[level] - elif level in LEVEL.values(): - level = 'field.actions.%s' % level - elif (str(level).startswith("field.actions") and - str(level).split(".")[-1] in LEVEL): - pass - else: - raise ValueError("Unknown access level '%s'" %level) - - params = {level: 1, - "oauth_token": credentials._request_token.key, - "lp.context": context or ""} - - lp_creds = ":".join((email, password)) - basic_auth = "Basic %s" % (lp_creds.encode('base64')) - headers = {'Authorization': basic_auth} - response, content = httplib2.Http().request(authorization_url, - method="POST", body=urllib.urlencode(params), headers=headers) - if int(response["status"]) != 200: - if not 300 <= int(response["status"]) <= 400: # this means redirection - raise HTTPError(response, content) - credentials.exchange_request_token_for_access_token(web_root) - return credentials