Skip to content

Commit 2e20f26

Browse files
committed
Merge pull request #732 from dhermes/bucket-contains-use-exists
Using Blob.exists() in Bucket.__contains__.
2 parents c490b68 + 4ea060a commit 2e20f26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gcloud/storage/bucket.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ def __repr__(self):
101101
def __iter__(self):
102102
return iter(self._iterator_class(bucket=self))
103103

104-
def __contains__(self, blob):
105-
return self.get_blob(blob) is not None
104+
def __contains__(self, blob_name):
105+
blob = Blob(blob_name, bucket=self)
106+
return blob.exists()
106107

107108
def exists(self):
108109
"""Determines whether or not this bucket exists.

0 commit comments

Comments
 (0)