XMLExportImport: support pickle protocol 3 and use it internally on py3
When exporting business templates, we need to build a list of referenced persistent objects to export them separately in the XML, this is is done using noload, in a way which does not support pickle protocol 1 (the persistent ids are None and the assertion in https://github.com/zopefoundation/ZODB/blob/d698507bb89eeb38c6e655199bc9f54c909dbf4d/src/ZODB/serialize.py#L669 fails), so we need to use pickle protocol 3, at least internally when building this list in Products.ERP5Type.XMLExportImport.reorderPickle. In the long term, we probably want to use pickle protocol 3 also when exporting business templates, although this commit also brings the full support of protocol 3, this is left for later, so that we keep a stable format of business template export. Later, once we are ready to switch to protocol 3 and re-export business templates, it should be enough to change Products.ERP5Type.XMLExportImport.DEFAULT_PICKLE_PROTOCOL to 3. While adding test coverage, it was found that the ad-hoc handling of boolean in protocol 1 was not implemented correctly and they were serialized as integers (0 for False and 1 for True), this is also fixed.
Showing
Please register or sign in to comment