Skip to content

Commit 0d0fca4

Browse files
jessegeensdiocas
authored andcommitted
Added option to disable versioning to the write_file method
1 parent 4e539b2 commit 0d0fca4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cs3client/file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def touch_file(self, auth_token: tuple, resource: Resource) -> None:
171171

172172
def write_file(
173173
self, auth_token: tuple, resource: Resource, content: Union[str, bytes], size: int,
174-
lock_md: tuple = ('', '')
174+
lock_md: tuple = ('', ''), disable_versioning: bool = False
175175
) -> None:
176176
"""
177177
Write a file using the given userid as access token. The entire content is written
@@ -184,6 +184,7 @@ def write_file(
184184
:param content: content to write
185185
:param size: size of content (optional)
186186
:param lock_md: tuple (<app_name>, <lock_id>)
187+
:param disable_versioning: bool to disable versioning on EOS
187188
:return: None (Success)
188189
:raises: FileLockedException (File is locked),
189190
:raises: AuthenticationException (Authentication failed)
@@ -230,6 +231,8 @@ def write_file(
230231
"X-Lock-Id": lock_id,
231232
"X-Lock_Holder": app_name,
232233
}
234+
if disable_versioning:
235+
headers.update({"X-Disable-Versioning": "true"})
233236
putres = requests.put(
234237
url=protocol.upload_endpoint,
235238
data=content,

0 commit comments

Comments
 (0)