Skip to content

Commit

Permalink
Fix GSBotoStorage connection kwargs (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneier authored Jun 22, 2017
1 parent 112ae43 commit aa0cd44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions storages/backends/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class GSBotoStorage(S3BotoStorage):
url_protocol = setting('GS_URL_PROTOCOL', 'http:')
host = setting('GS_HOST', GSConnection.DefaultHost)

def _get_connection_kwargs(self):
kwargs = super(GSBotoStorage, self)._get_connection_kwargs()
del kwargs['security_token']
return kwargs

def _save_content(self, key, content, headers):
# only pass backwards incompatible arguments if they vary from the default
options = {}
Expand Down
21 changes: 14 additions & 7 deletions storages/backends/s3boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,26 @@ def __init__(self, acl=None, bucket=None, **settings):
@property
def connection(self):
if self._connection is None:
kwargs = self._get_connection_kwargs()

self._connection = self.connection_class(
self.access_key,
self.secret_key,
security_token=self.security_token,
is_secure=self.use_ssl,
calling_format=self.calling_format,
host=self.host,
port=self.port,
proxy=self.proxy,
proxy_port=self.proxy_port
**kwargs
)
return self._connection

def _get_connection_kwargs(self):
return dict(
security_token=self.security_token,
is_secure=self.use_ssl,
calling_format=self.calling_format,
host=self.host,
port=self.port,
proxy=self.proxy,
proxy_port=self.proxy_port
)

@property
def bucket(self):
"""
Expand Down

0 comments on commit aa0cd44

Please sign in to comment.