Skip to content

Commit

Permalink
Added option to disable versioning to the write_file method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Geens authored and diocas committed Oct 1, 2024
1 parent 4e539b2 commit 0d0fca4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cs3client/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def touch_file(self, auth_token: tuple, resource: Resource) -> None:

def write_file(
self, auth_token: tuple, resource: Resource, content: Union[str, bytes], size: int,
lock_md: tuple = ('', '')
lock_md: tuple = ('', ''), disable_versioning: bool = False
) -> None:
"""
Write a file using the given userid as access token. The entire content is written
Expand All @@ -184,6 +184,7 @@ def write_file(
:param content: content to write
:param size: size of content (optional)
:param lock_md: tuple (<app_name>, <lock_id>)
:param disable_versioning: bool to disable versioning on EOS
:return: None (Success)
:raises: FileLockedException (File is locked),
:raises: AuthenticationException (Authentication failed)
Expand Down Expand Up @@ -230,6 +231,8 @@ def write_file(
"X-Lock-Id": lock_id,
"X-Lock_Holder": app_name,
}
if disable_versioning:
headers.update({"X-Disable-Versioning": "true"})
putres = requests.put(
url=protocol.upload_endpoint,
data=content,
Expand Down

0 comments on commit 0d0fca4

Please sign in to comment.