Merge lp:~niemeyer/txaws/fix-path-with-bucket into lp:txaws

Proposed by Gustavo Niemeyer
Status: Merged
Approved by: Jamu Kakar
Approved revision: 82
Merged at revision: 82
Proposed branch: lp:~niemeyer/txaws/fix-path-with-bucket
Merge into: lp:txaws
Diff against target: 27 lines (+3/-2)
2 files modified
txaws/s3/client.py (+2/-1)
txaws/s3/tests/test_client.py (+1/-1)
To merge this branch: bzr merge lp:~niemeyer/txaws/fix-path-with-bucket
Reviewer Review Type Date Requested Status
Jamu Kakar Approve
Review via email: mp+57753@code.launchpad.net

Description of the change

This fixes the use of bucket names in the paths when object names are
not used, and fixes the test to reflect it too.

To post a comment you must log in.
82. By Gustavo Niemeyer

Use bucket name when URLContext has no object name

Revision history for this message
Jamu Kakar (jkakar) wrote :

Look good here, thanks, +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'txaws/s3/client.py'
2--- txaws/s3/client.py 2011-04-13 14:49:52 +0000
3+++ txaws/s3/client.py 2011-04-14 19:52:30 +0000
4@@ -48,8 +48,9 @@
5
6 def get_path(self):
7 path = "/"
8+ if self.bucket is not None:
9+ path += self.bucket
10 if self.bucket is not None and self.object_name:
11- path += self.bucket
12 if not self.object_name.startswith("/"):
13 path += "/"
14 path += self.object_name
15
16=== modified file 'txaws/s3/tests/test_client.py'
17--- txaws/s3/tests/test_client.py 2011-04-13 14:49:52 +0000
18+++ txaws/s3/tests/test_client.py 2011-04-14 19:52:30 +0000
19@@ -34,7 +34,7 @@
20
21 def test_get_path_with_bucket(self):
22 url_context = client.URLContext(self.endpoint, bucket="mystuff")
23- self.assertEquals(url_context.get_path(), "/")
24+ self.assertEquals(url_context.get_path(), "/mystuff")
25
26 def test_get_path_with_bucket_and_object(self):
27 url_context = client.URLContext(

Subscribers

People subscribed via source and target branches