from Products.ERP5Type.Log import log
import base64

log("Data_chunk size: %s" % str(len(data_chunk)))
decoded = base64.b64decode(data_chunk)
log("Decoded data_chunk size: %s" % str(len(decoded)))

log("Appending to data stream: %s." % data_stream)

data_stream.appendData(decoded)

log("Ingested data successfully appended.")
context.logEntry("Datachunk (size %s) appended to Data Stream." % str(len(decoded)))
