• Jérome Perrin's avatar
    core: Fix unicode bug on ZODB History view. · 0162ede8
    Jérome Perrin authored
    Some objects, in our case BTrees.Length.Length in a ZODB connection
    have a __str__ method that returns unicode on python2:
    
    u'<BTrees.Length.Length object at 0x7f850932e0d0 oid 0x1e334 in <Connection at 7f854bc0f190>>'
    
    They cause an unicode error in the history view when they are
    concatenated together with other str (encoded as UTF-8) properties,
    this can be observed when using history view with a "folderish"
    document (but not with a File as in test_ZODBHistoryBinaryData).
    
    To prevent this issue, we use the fact that ''.format unlike '' %
    seem to apply a str() on arguments and use it instead.
    Co-authored-by: Yusei Tahara's avatarYusei Tahara <yusei@nexedi.com>
    0162ede8
test.erp5.testZODBHistory.py 6.45 KB