* Remove ubuntutools.lp.libsupport.approve_application, no longer used.

This commit is contained in:
Stefano Rivera 2011-02-28 23:56:09 +02:00
parent 77c95c7f24
commit fe63eaec05
2 changed files with 3 additions and 38 deletions

5
debian/changelog vendored
View File

@ -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 <stefanor@debian.org> Sun, 27 Feb 2011 23:07:06 +0200
-- Stefano Rivera <stefanor@debian.org> Mon, 28 Feb 2011 23:55:25 +0200
ubuntu-dev-tools (0.118) unstable; urgency=low

View File

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