From 0d0fca452cfead6d60543972cd6eb1a37caded2f Mon Sep 17 00:00:00 2001 From: Jesse Geens Date: Tue, 1 Oct 2024 16:20:01 +0200 Subject: [PATCH] Added option to disable versioning to the write_file method --- cs3client/file.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cs3client/file.py b/cs3client/file.py index ee08b82..d292726 100644 --- a/cs3client/file.py +++ b/cs3client/file.py @@ -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 @@ -184,6 +184,7 @@ def write_file( :param content: content to write :param size: size of content (optional) :param lock_md: tuple (, ) + :param disable_versioning: bool to disable versioning on EOS :return: None (Success) :raises: FileLockedException (File is locked), :raises: AuthenticationException (Authentication failed) @@ -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,