Reformat the code for pep8 Signed-off-by: Tomaz Muraus <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/697d8d0b Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/697d8d0b Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/697d8d0b Branch: refs/heads/trunk Commit: 697d8d0bb502183e61919d3a5a6119cbe577e072 Parents: f1c4252 Author: Franck Cuny <[email protected]> Authored: Mon Oct 20 07:53:21 2014 -0700 Committer: Tomaz Muraus <[email protected]> Committed: Thu Oct 23 16:15:29 2014 +0800 ---------------------------------------------------------------------- libcloud/common/google.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/697d8d0b/libcloud/common/google.py ---------------------------------------------------------------------- diff --git a/libcloud/common/google.py b/libcloud/common/google.py index 069b8dd..601d4e7 100644 --- a/libcloud/common/google.py +++ b/libcloud/common/google.py @@ -226,14 +226,22 @@ class GoogleResponse(JsonResponse): body = self.body json_error = True - if self.status in [httplib.OK, httplib.CREATED, httplib.ACCEPTED, httplib.CONFLICT]: + valid_http_codes = [ + httplib.OK, + httplib.CREATED, + httplib.ACCEPTED, + httplib.CONFLICT, + ] + if self.status in valid_http_codes: if json_error: raise JsonParseError(body, self.status, None) elif 'error' in body: (code, message) = self._get_error(body) if code == 'QUOTA_EXCEEDED': raise QuotaExceededError(message, self.status, code) - elif (code == 'RESOURCE_ALREADY_EXISTS' or code == 'alreadyExists'): + elif code == 'RESOURCE_ALREADY_EXISTS': + raise ResourceExistsError(message, self.status, code) + elif code == 'alreadyExists': raise ResourceExistsError(message, self.status, code) elif code.startswith('RESOURCE_IN_USE'): raise ResourceInUseError(message, self.status, code)
