BigFile: Factor out code to append data chunk to ._appendData()
So that data could be appended on server code via direct calls too.
NOTE previously ._read_data() accepted data=None argument and callers
were either providing it with current .data to append or None to forget
old content and just add new fresh one.
We could drop data=None from _read_data() signature, but leave it as is
for compatibility with outside code (e.g. zope's
OFS.Image.File.manage_upload() calls ._read_data(file) without any data
argument and in that case file content should be recreated, not
appended).
On the other hand we rework our code in .PUT() so for both "new content"
and "append range" in the end it always does "append" operation. For it
to work this way "new content" simply truncates the file before
proceeding to "append".
Reviewed-by: Romain Courteaud <romain@nexedi.com>
Showing
Please register or sign in to comment