def _open(self, name, mode): """ Retrieves the specified file from storage. """ return Blob(name, self._bucket)
def url(self, name): """ Returns an absolute URL where the file's contents can be accessed directly by a Web browser. """ return Blob(name, self._bucket).public_url
def __contains__(self, blob_name): blob = Blob(blob_name, bucket=self) return blob.exists()
def _makeOne(self, *args, **kw): from gcloud.storage.blob import Blob properties = kw.pop('properties', None) blob = Blob(*args, **kw) blob._properties = properties or {} return blob
def test_new_blob_existing(self): from gcloud.storage.blob import Blob bucket = self._makeOne() existing = Blob(None, bucket=bucket) self.assertTrue(bucket.new_blob(existing) is existing)
def _makeOne(self, *args, **kw): from gcloud.storage.blob import Blob return Blob(*args, **kw)