Gustavo Niemeyer has proposed merging lp:~niemeyer/txaws/s3-bucket-paths into 
lp:txaws.

Requested reviews:
  txAWS Developers (txaws-dev)

For more details, see:
https://code.launchpad.net/~niemeyer/txaws/s3-bucket-paths/+merge/57429

S3 used to work by providing a path to bucket names, and
then they started supporting a nice API via URLs. While
that tends to work well overall, it has an important
disavantage which is not working with alternative
implementations which provide an IP address only.

This change should remain compatible with Amazon's S3,
while offering the chance of interacting with the API
through an IP address.
-- 
https://code.launchpad.net/~niemeyer/txaws/s3-bucket-paths/+merge/57429
Your team txAWS Developers is requested to review the proposed merge of 
lp:~niemeyer/txaws/s3-bucket-paths into lp:txaws.
=== modified file 'bin/txaws-create-bucket'
--- bin/txaws-create-bucket	2010-01-13 20:04:32 +0000
+++ bin/txaws-create-bucket	2011-04-13 03:28:27 +0000
@@ -30,7 +30,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.create_bucket(options.bucket)

=== modified file 'bin/txaws-delete-bucket'
--- bin/txaws-delete-bucket	2010-01-13 20:04:32 +0000
+++ bin/txaws-delete-bucket	2011-04-13 03:28:27 +0000
@@ -30,7 +30,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.delete_bucket(options.bucket)

=== modified file 'bin/txaws-delete-object'
--- bin/txaws-delete-object	2010-01-13 20:04:32 +0000
+++ bin/txaws-delete-object	2011-04-13 03:28:27 +0000
@@ -34,7 +34,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.delete_object(options.bucket, options.object_name)

=== modified file 'bin/txaws-get-bucket'
--- bin/txaws-get-bucket	2010-01-13 20:04:32 +0000
+++ bin/txaws-get-bucket	2011-04-13 03:28:27 +0000
@@ -34,7 +34,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.get_bucket(options.bucket)

=== modified file 'bin/txaws-get-object'
--- bin/txaws-get-object	2010-01-13 20:04:32 +0000
+++ bin/txaws-get-object	2011-04-13 03:28:27 +0000
@@ -34,7 +34,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.get_object(options.bucket, options.object_name)

=== modified file 'bin/txaws-head-object'
--- bin/txaws-head-object	2010-01-13 20:04:32 +0000
+++ bin/txaws-head-object	2011-04-13 03:28:27 +0000
@@ -35,7 +35,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.head_object(options.bucket, options.object_name)

=== modified file 'bin/txaws-list-buckets'
--- bin/txaws-list-buckets	2010-01-13 20:04:32 +0000
+++ bin/txaws-list-buckets	2011-04-13 03:28:27 +0000
@@ -31,7 +31,7 @@
 options, args = parse_options(__doc__.strip())
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.list_buckets()

=== modified file 'bin/txaws-put-object'
--- bin/txaws-put-object	2010-01-13 20:04:32 +0000
+++ bin/txaws-put-object	2011-04-13 03:28:27 +0000
@@ -42,7 +42,7 @@
     sys.exit(1)
 creds = AWSCredentials(options.access_key, options.secret_key)
 region = AWSServiceRegion(
-    creds=creds, region=options.region, s3_endpoint=options.url)
+    creds=creds, region=options.region, s3_uri=options.url)
 client = region.get_s3_client()
 
 d = client.put_object(

=== modified file 'txaws/s3/client.py'
--- txaws/s3/client.py	2011-03-26 12:52:50 +0000
+++ txaws/s3/client.py	2011-04-13 03:28:27 +0000
@@ -43,14 +43,12 @@
         self.object_name = object_name
 
     def get_host(self):
-        if not self.bucket:
-            return self.endpoint.get_host()
-        else:
-            return "%s.%s" % (self.bucket, self.endpoint.get_host())
+        return self.endpoint.get_host()
 
     def get_path(self):
         path = "/"
         if self.bucket is not None and self.object_name:
+            path += self.bucket + "/"
             if self.object_name.startswith("/"):
                 path = self.object_name
             else:

_______________________________________________
Mailing list: https://launchpad.net/~txaws-dev
Post to     : txaws-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~txaws-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to