Skip to content

Commit

Permalink
Added swift compatbility support
Browse files Browse the repository at this point in the history
Swift requires the bucket names in all request URIs.

Added swift_compatible = True/False to the config options.
Disabled by default.
  • Loading branch information
Robert Carr committed Apr 24, 2012
1 parent 19a529a commit 1453aaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions S3/Config.py
Expand Up @@ -36,6 +36,7 @@ class Config(object):
acl_public = None
acl_grants = []
acl_revokes = []
swift_compatible = False
proxy_host = ""
proxy_port = 3128
encrypt = False
Expand Down
5 changes: 4 additions & 1 deletion S3/S3.py
Expand Up @@ -182,7 +182,10 @@ def format_uri(self, resource):
if resource['bucket'] and not check_bucket_name_dns_conformity(resource['bucket']):
uri = "/%s%s" % (resource['bucket'], resource['uri'])
else:
uri = resource['uri']
if self.config.swift_compatible and resource['bucket']:
uri = "/%s%s" % (resource['bucket'], resource['uri'])
else:
uri = resource['uri']
if self.config.proxy_host != "":
uri = "http://%s%s" % (self.get_hostname(resource['bucket']), uri)
debug('format_uri(): ' + uri)
Expand Down

0 comments on commit 1453aaa

Please sign in to comment.