Skip to content

Instantly share code, notes, and snippets.

@Flare183
Created August 10, 2010 21:05
Show Gist options
  • Save Flare183/518005 to your computer and use it in GitHub Desktop.
Save Flare183/518005 to your computer and use it in GitHub Desktop.
class MyLaunchpad(object):
"""Manage an authorised user's launchpad account"""
def __init__(self, project, credentials=None):
if not credentials:
credentials = DEFAULT_CRED % project
logging.info(_("Save cache file to %s") % credentials)
self._project = project
self._crds = None
self._cfile = credentials
self._me = None
self._lp = None
@property
def credentials(self):
"""Loaded credentials object"""
if not self._crds:
self._crds = Credentials(self._project)
if os.path.exists(self._cfile):
self._crds.load(open(self._cfile))
else:
self.request_credentials()
return self._crds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment