Commit aeb48a30 authored by Klaus Wölfel's avatar Klaus Wölfel

basic support for remote slice and list indexing of data arrays

parent e816e4d6
......@@ -147,6 +147,21 @@ class DataArray(BigFile):
RESPONSE.setHeader("Content-Type", "application/octet-stream")
# HTTP Range header handling: return True if we've served a range
# chunk out of our data.
# convert ranges from bytes to array indices
slice_index = REQUEST.get('slice_index', None)
if slice_index is not None:
slice_index_list = []
for index in slice_index:
slice_index_list.append(slice(index.get('start'),
index.get('stop'),
index.get('step')))
list_index = REQUEST.get('list_index', None)
if list_index is not None:
RESPONSE.write(self.getArray()[tuple(slice_index_list)][list_index].tobytes())
else:
RESPONSE.write(self.getArray()[tuple(slice_index_list)].tobytes())
return True
range = REQUEST.get_header('Range', None)
request_range = REQUEST.get_header('Request-Range', None)
if request_range is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment