Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to disable versioning to the write_file method #9

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading