Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions gcloud/storage/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ def patch(self):
:rtype: :class:`Bucket`
:returns: The current bucket.
"""
# Pass '?projection=full' here because 'PATCH' documented not
# to work properly w/ 'noAcl'.
update_properties = dict((key, self._properties[key])
for key in self._changes)
self._properties = self.connection.api_request(
method='PATCH', path=self.path, data=update_properties,
query_params={'projection': 'full'})
query_params={'projection': 'noAcl'})
return self


Expand Down
7 changes: 4 additions & 3 deletions gcloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,10 @@ def configure_website(self, main_page_suffix=None, not_found_page=None):
See: https://developers.google.com/storage/docs/website-configuration

.. note::
This (apparently) only works
if your bucket name is a domain name
(and to do that, you need to get approved somehow...).
This only works if your bucket name is a domain name
(and to do that, you need to get approved). See
https://cloud.google.com/storage/docs/bucket-naming#verification
to learn more about the process.

If you want this bucket to host a website, just provide the name
of an index page and a page to use when a blob isn't found::
Expand Down
6 changes: 3 additions & 3 deletions gcloud/storage/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_batch(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/path')
self.assertEqual(kw[0]['data'], {'foo': 'Qux', 'bar': 'Baz'})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_properties_no_fetch(self):
connection = _Connection({'foo': 'Foo'})
Expand Down Expand Up @@ -93,7 +93,7 @@ def test__patch_properties(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/path')
self.assertEqual(kw[0]['data'], {'foo': 'Foo'})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})


class Test_PropertyBatch(unittest2.TestCase):
Expand Down Expand Up @@ -162,7 +162,7 @@ def test___exit___no_error_calls_patch(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/path')
self.assertEqual(kw[0]['data'], {'foo': 'Qux', 'bar': 'Baz'})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})


class Test__scalar_property(unittest2.TestCase):
Expand Down
16 changes: 8 additions & 8 deletions gcloud/storage/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def test_cache_control_setter(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'], {'cacheControl': CACHE_CONTROL})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_component_count(self):
BLOB_NAME = 'blob-name'
Expand Down Expand Up @@ -717,7 +717,7 @@ def test_content_disposition_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'contentDisposition': CONTENT_DISPOSITION})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_content_encoding_getter(self):
BLOB_NAME = 'blob-name'
Expand All @@ -744,7 +744,7 @@ def test_content_encoding_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'contentEncoding': CONTENT_ENCODING})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_content_language_getter(self):
BLOB_NAME = 'blob-name'
Expand All @@ -771,7 +771,7 @@ def test_content_language_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'contentLanguage': CONTENT_LANGUAGE})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_content_type_getter(self):
BLOB_NAME = 'blob-name'
Expand All @@ -798,7 +798,7 @@ def test_content_type_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'contentType': CONTENT_TYPE})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_crc32c_getter(self):
BLOB_NAME = 'blob-name'
Expand All @@ -825,7 +825,7 @@ def test_crc32c_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'crc32c': CRC32C})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_etag(self):
BLOB_NAME = 'blob-name'
Expand Down Expand Up @@ -879,7 +879,7 @@ def test_md5_hash_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'md5Hash': MD5_HASH})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_media_link(self):
BLOB_NAME = 'blob-name'
Expand Down Expand Up @@ -915,7 +915,7 @@ def test_metadata_setter(self):
self.assertEqual(kw[0]['path'], '/b/name/o/%s' % BLOB_NAME)
self.assertEqual(kw[0]['data'],
{'metadata': METADATA})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_metageneration(self):
BLOB_NAME = 'blob-name'
Expand Down
20 changes: 10 additions & 10 deletions gcloud/storage/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def test_update_cors(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], after)
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})
entries = bucket.get_cors()
self.assertEqual(entries, [CORS_ENTRY, {}])

Expand Down Expand Up @@ -734,7 +734,7 @@ def test_update_lifecycle(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], after)
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})
entries = bucket.get_lifecycle()
self.assertEqual(len(entries), 1)
self.assertEqual(entries[0]['action']['type'], 'Delete')
Expand All @@ -761,7 +761,7 @@ def test_location_setter(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], {'location': 'AS'})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_get_logging_w_prefix(self):
NAME = 'name'
Expand Down Expand Up @@ -809,7 +809,7 @@ def test_enable_logging_defaults(self):
self.assertEqual(kw[1]['method'], 'PATCH')
self.assertEqual(kw[1]['path'], '/b/%s' % NAME)
self.assertEqual(kw[1]['data'], resp_to_enable_logging)
self.assertEqual(kw[1]['query_params'], {'projection': 'full'})
self.assertEqual(kw[1]['query_params'], {'projection': 'noAcl'})
self.assertEqual(kw[2]['method'], 'GET')
self.assertEqual(kw[2]['path'], '/b/%s' % NAME)
self.assertEqual(kw[2]['query_params'], {'projection': 'noAcl'})
Expand Down Expand Up @@ -840,7 +840,7 @@ def test_enable_logging_explicit(self):
self.assertEqual(kw[1]['method'], 'PATCH')
self.assertEqual(kw[1]['path'], '/b/%s' % NAME)
self.assertEqual(kw[1]['data'], resp_to_enable_logging)
self.assertEqual(kw[1]['query_params'], {'projection': 'full'})
self.assertEqual(kw[1]['query_params'], {'projection': 'noAcl'})
self.assertEqual(kw[2]['method'], 'GET')
self.assertEqual(kw[2]['path'], '/b/%s' % NAME)
self.assertEqual(kw[2]['query_params'], {'projection': 'noAcl'})
Expand All @@ -864,7 +864,7 @@ def test_disable_logging(self):
self.assertEqual(kw[1]['method'], 'PATCH')
self.assertEqual(kw[1]['path'], '/b/%s' % NAME)
self.assertEqual(kw[1]['data'], {'logging': None})
self.assertEqual(kw[1]['query_params'], {'projection': 'full'})
self.assertEqual(kw[1]['query_params'], {'projection': 'noAcl'})
self.assertEqual(kw[2]['method'], 'GET')
self.assertEqual(kw[2]['path'], '/b/%s' % NAME)
self.assertEqual(kw[2]['query_params'], {'projection': 'noAcl'})
Expand Down Expand Up @@ -942,7 +942,7 @@ def test_versioning_enabled_setter(self):
self.assertEqual(len(kw), 1)
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['data'], {'versioning': {'enabled': True}})
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_configure_website_defaults(self):
NAME = 'name'
Expand All @@ -957,7 +957,7 @@ def test_configure_website_defaults(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], patched)
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_configure_website_explicit(self):
NAME = 'name'
Expand All @@ -972,7 +972,7 @@ def test_configure_website_explicit(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], patched)
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_disable_website(self):
NAME = 'name'
Expand All @@ -987,7 +987,7 @@ def test_disable_website(self):
self.assertEqual(kw[0]['method'], 'PATCH')
self.assertEqual(kw[0]['path'], '/b/%s' % NAME)
self.assertEqual(kw[0]['data'], patched)
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
self.assertEqual(kw[0]['query_params'], {'projection': 'noAcl'})

def test_make_public_defaults(self):
from gcloud.storage.acl import _ACLEntity
Expand Down