Created
August 10, 2010 21:05
-
-
Save Flare183/518005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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