Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #138: clear existing (local) ACL when saving ACL to server. #192

Merged
merged 2 commits into from
Sep 30, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix #138: clear existing (local) ACL when saving ACL to server.
  • Loading branch information
tseaver committed Sep 26, 2014
commit fb756b2d2959bad56fc8336fb5aa5aa0191590ab
4 changes: 3 additions & 1 deletion gcloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ def save_acl(self, acl=None):
if acl is None:
return self

return self.patch_metadata({'acl': list(acl)})
self.patch_metadata({'acl': list(acl)})
self.reload_acl()
return self

def clear_acl(self):
"""Remove all ACL rules from the bucket.
Expand Down
4 changes: 3 additions & 1 deletion gcloud/storage/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ def save_acl(self, acl=None):
if acl is None:
return self

return self.patch_metadata({'acl': list(acl)})
self.patch_metadata({'acl': list(acl)})
self.reload_acl()
return self

def clear_acl(self):
"""Remove all ACL rules from the key.
Expand Down
6 changes: 2 additions & 4 deletions gcloud/storage/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ def test_save_acl_existing_set_new_passed(self):
bucket = self._makeOne(connection, NAME, metadata)
bucket.reload_acl()
self.assertTrue(bucket.save_acl(new_acl) is bucket)
# See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138
#self.assertEqual(list(bucket.acl), new_acl)
self.assertEqual(list(bucket.acl), new_acl)
kw = connection._requested
self.assertEqual(len(kw), 1)
self.assertEqual(kw[0]['method'], 'PATCH')
Expand All @@ -550,8 +549,7 @@ def test_clear_acl(self):
bucket = self._makeOne(connection, NAME, metadata)
bucket.reload_acl()
self.assertTrue(bucket.clear_acl() is bucket)
# See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138
#self.assertEqual(list(bucket.acl), [])
self.assertEqual(list(bucket.acl), [])
kw = connection._requested
self.assertEqual(len(kw), 1)
self.assertEqual(kw[0]['method'], 'PATCH')
Expand Down
6 changes: 2 additions & 4 deletions gcloud/storage/test_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ def test_save_acl_existing_set_new_passed(self):
key = self._makeOne(bucket, KEY, metadata)
key.reload_acl()
self.assertTrue(key.save_acl(new_acl) is key)
# See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138
#self.assertEqual(list(bucket.acl), new_acl)
self.assertEqual(list(key.acl), new_acl)
kw = connection._requested
self.assertEqual(len(kw), 1)
self.assertEqual(kw[0]['method'], 'PATCH')
Expand All @@ -528,8 +527,7 @@ def test_clear_acl(self):
key = self._makeOne(bucket, KEY, metadata)
key.reload_acl()
self.assertTrue(key.clear_acl() is key)
# See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138
#self.assertEqual(list(key.acl), [])
self.assertEqual(list(key.acl), [])
kw = connection._requested
self.assertEqual(len(kw), 1)
self.assertEqual(kw[0]['method'], 'PATCH')
Expand Down