From a435c3234b76c0f1e9ea5b8c6a2fa59eacb9ce29 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Tue, 21 Dec 2010 21:52:12 +0200 Subject: [PATCH] Use the improved staging support in lpapicache --- requestsync | 6 +----- ubuntutools/lp/lpapicache.py | 5 +++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/requestsync b/requestsync index 59ef919..5f4cd87 100755 --- a/requestsync +++ b/requestsync @@ -91,10 +91,6 @@ if __name__ == '__main__': # import the needed requestsync module if options.lpapi: - # Needs to be set before lpapicache is imported: - import ubuntutools.lp - ubuntutools.lp.service = options.lpinstance - from ubuntutools.requestsync.lp import (checkExistingReports, getDebianSrcPkg, getUbuntuSrcPkg, @@ -103,7 +99,7 @@ if __name__ == '__main__': # See if we have LP credentials and exit if we don't - cannot continue in this case try: - Launchpad.login() + Launchpad.login(service=options.lpinstance) except IOError: sys.exit(1) else: diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index 9de3474..9163045 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -52,11 +52,12 @@ __all__ = [ class Launchpad(object): '''Singleton for LP API access.''' - def login(self): + def login(self, service=service): '''Enforce a non-anonymous login.''' if '_Launchpad__lp' not in self.__dict__: try: - self.__lp = libsupport.get_launchpad('ubuntu-dev-tools') + self.__lp = libsupport.get_launchpad('ubuntu-dev-tools', + server=service) except IOError, error: print >> sys.stderr, 'E: %s' % error raise