Merge lp:~dobey/tarmac/login-with into lp:tarmac

Proposed by dobey
Status: Merged
Approved by: Paul Hummer
Approved revision: 390
Merged at revision: 390
Proposed branch: lp:~dobey/tarmac/login-with
Merge into: lp:tarmac
Diff against target: 35 lines (+5/-13)
1 file modified
tarmac/bin/commands.py (+5/-13)
To merge this branch: bzr merge lp:~dobey/tarmac/login-with
Reviewer Review Type Date Requested Status
Paul Hummer Approve
Review via email: mp+52451@code.launchpad.net

Commit message

Use Launchpad.login_with instead of managing credentials manually

Description of the change

Tests still pass for me with both launchpadlib 1.6.2 and 1.9.7.

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tarmac/bin/commands.py'
2--- tarmac/bin/commands.py 2011-02-14 15:19:59 +0000
3+++ tarmac/bin/commands.py 2011-03-07 18:10:30 +0000
4@@ -7,7 +7,7 @@
5 from bzrlib.commands import Command
6 from bzrlib.errors import PointlessMerge
7 from bzrlib.help import help_commands
8-from launchpadlib.launchpad import (Credentials, Launchpad)
9+from launchpadlib.launchpad import Launchpad
10 from launchpadlib.uris import (LPNET_SERVICE_ROOT,
11 STAGING_SERVICE_ROOT)
12
13@@ -81,18 +81,10 @@
14 self.logger.debug(" Fetching new credentials from {0}".format(
15 SERVICE_ROOT))
16
17- launchpad = Launchpad.get_token_and_login(
18- 'Tarmac', SERVICE_ROOT, self.config.CACHE_HOME)
19- launchpad.credentials.save(file(filename, 'w'))
20-
21- self.logger.debug(" Credentials saved to {0}".format(filename))
22- else:
23- credentials = Credentials()
24- credentials.load(open(filename))
25- self.logger.debug(" Credentials loaded".format(filename))
26-
27- launchpad = Launchpad(
28- credentials, SERVICE_ROOT, self.config.CACHE_HOME)
29+ launchpad = Launchpad.login_with(
30+ u'Tarmac', service_root=SERVICE_ROOT,
31+ credentials_file=filename,
32+ launchpadlib_dir=self.config.CACHE_HOME)
33
34 self.logger.debug("Connected")
35 return launchpad

Subscribers

People subscribed via source and target branches