diff --git a/swift/common/direct_client.py b/swift/common/direct_client.py index 3058309b8b..db7c48aa7e 100644 --- a/swift/common/direct_client.py +++ b/swift/common/direct_client.py @@ -513,14 +513,8 @@ def retry(func, *args, **kwargs): :returns: result of func :raises ClientException: all retries failed """ - retries = 5 - if 'retries' in kwargs: - retries = kwargs['retries'] - del kwargs['retries'] - error_log = None - if 'error_log' in kwargs: - error_log = kwargs['error_log'] - del kwargs['error_log'] + retries = kwargs.pop('retries', 5) + error_log = kwargs.pop('error_log', None) attempts = 0 backoff = 1 while attempts <= retries: diff --git a/swift/common/exceptions.py b/swift/common/exceptions.py index 54b4e2e2ea..2f36ab623d 100644 --- a/swift/common/exceptions.py +++ b/swift/common/exceptions.py @@ -214,9 +214,9 @@ class APIVersionError(SwiftException): class ClientException(Exception): def __init__(self, msg, http_scheme='', http_host='', http_port='', - http_path='', http_query='', http_status=0, http_reason='', + http_path='', http_query='', http_status=None, http_reason='', http_device='', http_response_content='', http_headers=None): - Exception.__init__(self, msg) + super(ClientException, self).__init__(msg) self.msg = msg self.http_scheme = http_scheme self.http_host = http_host