Products.PortalTransforms.data.datastream.getData() changes?

The quick fix is to change collective.cover's code here:

searchable_text = data.getData()
if isinstance(searchable_text, six.binary_type):
    searchable_text = searchable_text.decode('utf-8')

or

from Products.CMFPlone.utils import safe_unicode
return safe_unicode(data.getData())

Unluckily the output of convertTo has changed in a non retrocompatible way in a minor release and nobody noticed this.

Apparently convertTo should return a str object in both Python 2 and 3.

That is very bad and I am sorry it happened but it is good that now we know.
Not really sure how to fix this easily and in a fast way upstream.

2 Likes