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

Martin Langhoff martin at laptop.org
Mon Oct 1 12:59:00 EDT 2012


On Mon, Oct 1, 2012 at 12:46 PM, Manuel Kaufmann <humitos at gmail.com> wrote:
> Sorry for the Top-Posting, maybe you didn't see the section that I
> included in my last email.

Ah, yeah, didn't catch that.

> 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()"?

That's actually not changed code.. only changes indentation. I don't
like it, I very seriously don't like it, but fixing the problem is
outside the scope of this patchset. Why do we do str(), I don't know.
I believe it's a noop in this case.

The problem is that we are dealing with some raw binary data (ie:
thumbnails) as if it were a string. You can get away with that as long
as your string ops are 8-bit clean. Once we move to utf-8, they won't
be.

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

In the future in general. Yes, we'll hit it with Python 3, perhaps even sooner.


m
-- 
 martin at laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the Sugar-devel mailing list