From 91d64baf890b556e74278d86457b98529a9cdbee Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Fri, 13 Mar 2015 23:22:41 -0600 Subject: [PATCH] Using Blob.exists() in Bucket.__contains__. --- gcloud/storage/bucket.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcloud/storage/bucket.py b/gcloud/storage/bucket.py index 7e028b648af46..154429f167cb6 100644 --- a/gcloud/storage/bucket.py +++ b/gcloud/storage/bucket.py @@ -101,8 +101,9 @@ def __repr__(self): def __iter__(self): return iter(self._iterator_class(bucket=self)) - def __contains__(self, blob): - return self.get_blob(blob) is not None + def __contains__(self, blob_name): + blob = Blob(blob_name, bucket=self) + return blob.exists() def exists(self): """Determines whether or not this bucket exists.