Drop hack method from manage-credentials

This commit is contained in:
Stefano Rivera 2010-09-05 02:43:46 +02:00
commit 4140992fab
2 changed files with 11 additions and 29 deletions

View File

@ -47,23 +47,16 @@ Launchpad token. 0 is unauthorized, 1 is read public data, 2; write public data,
3; read private data and 4; write private data.
.SH EXAMPLE USAGE
There are currently two ways of using \fBmanage-credentials\fR to get
Launchpad tokens.
To get Launchpad tokens using \fBmanage-credentials\fR, run the following command:
.TP
1) manage-credentials create \-c CONSUMER \-\-level 2
manage-credentials create \-c CONSUMER \-\-level 2
.TP
This way shall open your webbrowser with a Launchpad login page.
.TP
2) manage-credentials create \-c CONSUMER \-\-level 2 \-\-password BOO \-\-email me@example.com
.TP
This is a hack, but it works and does not require a webbrowser .
This will open your web browser with a Launchpad login page.
.TP
If you intend to use manage-credentials for Ubuntu development (such as
the ubuntu-dev-tools package). Please by sure to run the following:
the ubuntu-dev-tools package). Please be sure to run the following:
.TP
manage-credentials create \-c ubuntu-dev-tools \-l 2

View File

@ -23,21 +23,17 @@ import os
import sys
from optparse import OptionParser, make_option
from launchpadlib.uris import lookup_service_root
from ubuntutools.lp.libsupport import *
from ubuntutools.lp.libsupport import Launchpad, translate_web_api, LEVEL
class CmdOptions(OptionParser):
USAGE = (
"\t%prog create -c <consumer> [--email <email> --password <password>] [--service <staging|edge>]"
"\t%prog create -c <consumer> [--service <staging|edge>]"
)
OPTIONS = (
make_option("-c", "--consumer", action="store", type="string",
dest="consumer", default=None),
make_option("-e", "--email", action="store", type="string",
dest="email", default=None),
make_option("-p", "--password", action="store", type="string",
dest="password", default=None),
make_option("-s", "--service", action="store", type="string",
dest="service", default="edge"),
make_option("--cache", action="store", type="string",
@ -51,7 +47,7 @@ class CmdOptions(OptionParser):
TOOLS = {
"create": ( ("consumer",),
("email", "password", "service", "cache", "output",
("service", "cache", "output",
"level")),
"list": (tuple(), ("service", )),
}
@ -88,17 +84,10 @@ class CmdOptions(OptionParser):
return tool, options
def create_credentials(options):
if options.password and options.email:
# use hack
credentials = Credentials(options.consumer)
credentials = approve_application(credentials, options.email,
options.password, options.level,
translate_api_web(options.service), None)
else:
launchpad = Launchpad.get_token_and_login(options.consumer,
options.service, options.cache)
credentials = launchpad.credentials
launchpad = Launchpad.get_token_and_login(options.consumer,
options.service, options.cache)
credentials = launchpad.credentials
if options.output:
filepath = options.output
else: