Code review comment for lp:~leonardr/launchpadlib/trusted-workflow

Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Leonard,

This branch looks good. Just one comment below.

merge-approved

-Edwin

>=== modified file 'src/launchpadlib/credentials.py'
>--- src/launchpadlib/credentials.py 2009-10-27 15:24:36 +0000
>+++ src/launchpadlib/credentials.py 2009-10-28 20:22:45 +0000
>+
>+ def get_http_credentials(self, cached_username=None, failed_attempts=0):

Missing docstring.

>+ username = self.input_username(
>+ cached_username, self.message(self.INPUT_USERNAME))
>+ if username is None:
>+ self.open_login_page_in_user_browser(
>+ urljoin(self.web_root, "+login"))
>+ raise NoLaunchpadAccount(
>+ self.message(self.YOU_NEED_A_LAUNCHPAD_ACCOUNT))
>+ password = self.input_password(self.message(self.INPUT_PASSWORD))
>+ response, content = self.browser.get_token_info(
>+ username, password, self.request_token, self.allow_access_levels)
>+ if response.status == 500:
>+ raise ServerError(self.message(SERVER_ERROR))
>+ elif response.status == 401:
>+ failed_attempts += 1
>+ if failed_attempts == self.max_failed_attempts:
>+ raise TooManyAuthenticationFailures(
>+ self.message(self.TOO_MANY_AUTHENTICATION_FAILURES))
>+ else:
>+ self.authentication_failure(
>+ self.message(self.AUTHENTICATION_FAILURE))
>+ return self.get_http_credentials(username, failed_attempts)
>+ token_info = simplejson.loads(content)
>+ return username, password, token_info

review: Approve (code)

« Back to merge proposal