[Sugar-devel] [PATCH 3/7] metadatastore: store/change files on disk defensively #2317

Manuel Kaufmann humitos at gmail.com
Mon Oct 1 12:46:00 EDT 2012


On Sun, Sep 30, 2012 at 3:10 PM, Manuel Kaufmann <humitos at gmail.com> wrote:
> The only thing that I do not understand well is this comment /
> section. Can you explain to me this a bit more? Thanks
>
>
> On Fri, Sep 21, 2012 at 12:55 AM, Martin Langhoff <martin at laptop.org> wrote:
>> +        # FIXME: this codepath handles raw image data
>> +        # str() is 8-bit clean right now, but
>> +        # this won't last. We will need more explicit
>> +        # handling of strings, int/floats vs raw data
>> +        if isinstance(value, unicode):
>> +            value = value.encode('utf-8')
>> +        elif not isinstance(value, basestring):
>> +            value = str(value)

Sorry for the Top-Posting, maybe you didn't see the section that I
included in my last email.

>From that section I understand that we are encoding the data into
utf-8 if value is "unicode", but if it is just a "basestring", why we
are doing "str()"?

The FIXME comment refers to a problem we will have with Python 3 in
the future, right?

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/


More information about the Sugar-devel mailing list