diff --git a/gcloud/storage/api.py b/gcloud/storage/api.py index b25a5149ca87..b16ce1842e12 100644 --- a/gcloud/storage/api.py +++ b/gcloud/storage/api.py @@ -126,7 +126,7 @@ def list_buckets(project=None, max_results=None, page_token=None, prefix=None, # class has it as a reserved property. if page_token is not None: result.next_page_token = page_token - return iter(result) + return result def get_bucket(bucket_name, connection=None): diff --git a/gcloud/storage/blob.py b/gcloud/storage/blob.py index 2776b71153a5..085d1870e1a0 100644 --- a/gcloud/storage/blob.py +++ b/gcloud/storage/blob.py @@ -226,9 +226,14 @@ def exists(self, connection=None): # We only need the status code (200 or not) so we seek to # minimize the returned payload. query_params = {'fields': 'name'} + # We intentionally pass `_target_object=None` since fields=name + # would limit the local properties. connection.api_request(method='GET', path=self.path, query_params=query_params, - _target_object=self) + _target_object=None) + # NOTE: This will not fail immediately in a batch. However, when + # Batch.finish() is called, the resulting `NotFound` will be + # raised. return True except NotFound: return False