mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-09 07:51:28 +00:00
lpapicache.py:
- Catch IOError from libsupport.get_launchpad(), display the error and exit - Bug fix in PersonTeam.canUploadPackage() - Remove leftover code from PersonTeam.isPerPackageUploader()
This commit is contained in:
parent
a1457492b4
commit
30bb23a2b7
@ -24,6 +24,7 @@
|
|||||||
#import httplib2
|
#import httplib2
|
||||||
#httplib2.debuglevel = 1
|
#httplib2.debuglevel = 1
|
||||||
|
|
||||||
|
import sys
|
||||||
import libsupport
|
import libsupport
|
||||||
from launchpadlib.errors import HTTPError
|
from launchpadlib.errors import HTTPError
|
||||||
from launchpadlib.resource import Entry
|
from launchpadlib.resource import Entry
|
||||||
@ -38,7 +39,11 @@ class Launchpad(object):
|
|||||||
Enforce a login through the LP API.
|
Enforce a login through the LP API.
|
||||||
'''
|
'''
|
||||||
if not self.__lp:
|
if not self.__lp:
|
||||||
self.__lp = libsupport.get_launchpad('ubuntu-dev-tools')
|
try:
|
||||||
|
self.__lp = libsupport.get_launchpad('ubuntu-dev-tools')
|
||||||
|
except IOError, error:
|
||||||
|
print >> sys.stderr, 'E: %s' % error
|
||||||
|
sys.exit(1)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
@ -458,9 +463,9 @@ class PersonTeam(BaseWrapper):
|
|||||||
'''
|
'''
|
||||||
if not isinstance(archive, Archive):
|
if not isinstance(archive, Archive):
|
||||||
raise TypeError("'%r' is not an Archive object." % archive)
|
raise TypeError("'%r' is not an Archive object." % archive)
|
||||||
if not isinstance(package, (str, None)):
|
if package and not isinstance(package, str):
|
||||||
raise TypeError('A source package name expected.')
|
raise TypeError('A source package name expected.')
|
||||||
if not isinstance(component, (str, None)):
|
if component and not isinstance(component, str):
|
||||||
raise TypeError('A component name expected.')
|
raise TypeError('A component name expected.')
|
||||||
if not package and not component:
|
if not package and not component:
|
||||||
raise ValueError('Either a source package name or a component has to be specified.')
|
raise ValueError('Either a source package name or a component has to be specified.')
|
||||||
@ -494,10 +499,8 @@ class PersonTeam(BaseWrapper):
|
|||||||
'''
|
'''
|
||||||
if isinstance(package, SourcePackagePublishingHistory):
|
if isinstance(package, SourcePackagePublishingHistory):
|
||||||
pkg = package.getPackageName()
|
pkg = package.getPackageName()
|
||||||
comp = package.getComponent()
|
|
||||||
else:
|
else:
|
||||||
pkg = package
|
pkg = package
|
||||||
compon
|
|
||||||
|
|
||||||
return self.canUploadPackage(archive, pkg, None)
|
return self.canUploadPackage(archive, pkg, None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user