load bytes objects directly as bytes
While upgrade instance from python2 to python3, i found when read old BigFile object such as Data Stream, it raise error below
Module erp5.component.document.erp5_version.BigFile, line 105, in getData
return btree.read(0, len(btree))
Module erp5.component.module.erp5_version.BTreeData, line 182, in read
return b''.join(self.iterate(offset, size))
TypeError: sequence item 0: expected a bytes-like object, str found
It's because the old data created when in python2 is firstly loaded as string
but for PersistentString, we're sure that it's bytes, let's load directly as bytes to avoid useless conversion.
in this MR, we also clean some codes
Related MR: erp5-bin!12 (merged)