• Jérome Perrin's avatar
    XMLExportImport: support python3 · a7e995d4
    Jérome Perrin authored
    This includes heuristics to guess the str or bytes from business template
    XML: oids are bytes and also some strings that do not decode to UTF-8,
    so that we can install python2 business templates 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 on py3
    (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 on py3.
    
    With these changes, on py2 we are still using the same protocol 1 and
    the output is stable, but on py3 we are using protocol 3 and the output
    is different. Business template exported on py
    
    This also adds some test coverage of XMLExportImport, while doing this
    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.
    a7e995d4
test.erp5.testXMLPickle.py 10.6 KB