Use the improved staging support in lpapicache

This commit is contained in:
Stefano Rivera 2010-12-21 21:52:12 +02:00
parent 13cbe49a19
commit a435c3234b
2 changed files with 4 additions and 7 deletions

View File

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

View File

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