Skip to content

Commit

Permalink
Using Blob.exists() in Bucket.__contains__.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Mar 14, 2015
1 parent d668044 commit 91d64ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gcloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 91d64ba

Please sign in to comment.