From d4f6f9079edd1088d143efdf840c987dffa1cd02 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Fri, 12 Jun 2009 00:33:23 +0200 Subject: [PATCH] * ubuntutools/lp/lpapiwrapper.py: Add a method to enforce a login through the LP API. --- ubuntutools/lp/lpapiwrapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ubuntutools/lp/lpapiwrapper.py b/ubuntutools/lp/lpapiwrapper.py index b4ca3e9..f276e56 100644 --- a/ubuntutools/lp/lpapiwrapper.py +++ b/ubuntutools/lp/lpapiwrapper.py @@ -33,9 +33,16 @@ class Launchpad(object): ''' Singleton for LP API access. ''' __lp = None - def __getattr__(self, attr): + def login(self): + ''' + Enforce a login through the LP API. + ''' if not self.__lp: self.__lp = libsupport.get_launchpad('ubuntu-dev-tools') + + def __getattr__(self, attr): + if not self.__lp: + self.login() return getattr(self.__lp, attr) def __call__(self):