Skip to content

Commit

Permalink
Merge pull request #327 from tseaver/162-document-key-upload-overwrit…
Browse files Browse the repository at this point in the history
…e-semantics

Fix #162:  Document semantics of upload to existing key.
  • Loading branch information
tseaver committed Nov 3, 2014
2 parents f33e557 + 0eefb21 commit a0df78a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions gcloud/storage/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
content_type=None):
"""Upload the contents of this key from a file-like object.
.. note::
The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.
See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.
:type file_obj: file
:param file_obj: A file handle open for reading.
Expand Down Expand Up @@ -276,6 +288,18 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
def upload_from_filename(self, filename):
"""Upload this key's contents from the content of f named file.
.. note::
The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.
See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.
:type filename: string
:param filename: The path to the file.
"""
Expand All @@ -290,6 +314,18 @@ def upload_from_filename(self, filename):
def upload_from_string(self, data, content_type='text/plain'):
"""Upload contents of this key from the provided string.
.. note::
The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.
See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.
:type data: string
:param data: The data to store in this key.
Expand Down

0 comments on commit a0df78a

Please sign in to comment.