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
=== modified file 'tarmac/bin/commands.py'
--- tarmac/bin/commands.py 2011-02-14 15:19:59 +0000
+++ tarmac/bin/commands.py 2011-03-07 18:10:30 +0000
@@ -7,7 +7,7 @@
7from bzrlib.commands import Command7from bzrlib.commands import Command
8from bzrlib.errors import PointlessMerge8from bzrlib.errors import PointlessMerge
9from bzrlib.help import help_commands9from bzrlib.help import help_commands
10from launchpadlib.launchpad import (Credentials, Launchpad)10from launchpadlib.launchpad import Launchpad
11from launchpadlib.uris import (LPNET_SERVICE_ROOT,11from launchpadlib.uris import (LPNET_SERVICE_ROOT,
12 STAGING_SERVICE_ROOT)12 STAGING_SERVICE_ROOT)
1313
@@ -81,18 +81,10 @@
81 self.logger.debug(" Fetching new credentials from {0}".format(81 self.logger.debug(" Fetching new credentials from {0}".format(
82 SERVICE_ROOT))82 SERVICE_ROOT))
8383
84 launchpad = Launchpad.get_token_and_login(84 launchpad = Launchpad.login_with(
85 'Tarmac', SERVICE_ROOT, self.config.CACHE_HOME)85 u'Tarmac', service_root=SERVICE_ROOT,
86 launchpad.credentials.save(file(filename, 'w'))86 credentials_file=filename,
8787 launchpadlib_dir=self.config.CACHE_HOME)
88 self.logger.debug(" Credentials saved to {0}".format(filename))
89 else:
90 credentials = Credentials()
91 credentials.load(open(filename))
92 self.logger.debug(" Credentials loaded".format(filename))
93
94 launchpad = Launchpad(
95 credentials, SERVICE_ROOT, self.config.CACHE_HOME)
9688
97 self.logger.debug("Connected")89 self.logger.debug("Connected")
98 return launchpad90 return launchpad

Subscribers

People subscribed via source and target branches