#10807 NORM 11.2.0-: Can not copy book downloaded with getbook to usb key
Zarro Boogs per Child
bugtracker at laptop.org
Mon Apr 11 10:49:49 EDT 2011
#10807: Can not copy book downloaded with getbook to usb key
------------------------------+---------------------------------------------
Reporter: erikos | Owner: erikos
Type: defect | Status: new
Priority: normal | Milestone: 11.2.0-M4
Component: sugar | Version: Development build as of this date
Resolution: | Keywords:
Next_action: review | Verified: 0
Deployment_affected: | Blockedby:
Blocking: |
------------------------------+---------------------------------------------
Comment(by erikos):
Replying to [comment:6 sascha_silbe]:
> Replying to [comment:3 erikos]:
> > b) we can think about if we should omit data that can not be written
to the json-format before, and as well if we should convert it to
something writable before trying to write the json format (would need to
detect and restore those entries then as well).
>
> I expected this to bite us sooner or later. All existing metadata import
/ export code - except that in [http://activities.sugarlabs.org/en-
US/sugar/addon/4326 Backup] and [http://activities.sugarlabs.org/en-
US/sugar/addon/4327 Restore] - assumes that {{{preview}}} is the only
"binary" property. We touched that topic slightly during review (on IRC),
but did not discuss it in depth - partially because the current
[http://git.sugarlabs.org/sugar/mainline/blobs/master/src/jarabe/journal/journalentrybundle.py
JEB support code] has the same issue.
>
> The Sugar 0.84+ data store D-Bus API [http://git.sugarlabs.org/sugar-
datastore/mainline/blobs/master/src/carquinyol/metadatareader.c#line82
treats] all properties as D-Bus byte arrays (signature {{{ay}}}). The low-
level Activity API documentation
[http://wiki.sugarlabs.org/go/Development_Team/Low-
level_Activity_API#Meta_Data mentions this]. So property values should be
treated as byte strings ("binary"), not characters strings (unicode).
Character strings should be serialised to UTF-8.
>
> The problem we're facing is that JSON doesn't have support for byte
strings, only character strings. That's why
[http://wiki.laptop.org/go/Journal_entry_bundles JEB]s have "external"
properties, i.e. values stored outside of the JSON file. Most code only
handles a single external property called {{{preview}}}, but there's no
inherent reason for not doing the same with other properties that are
large or contain data that cannot be represented in UTF-8 (like Backup and
Restore already do).
>
I thought so too first. On the other hand, I think it will make the code
more complex. Activities can base64 the custom metadata. I think that is
an ok compromise, if noted in documentation. So far the activities have
been rare that needed to store binary metadata.
--
Ticket URL: <http://dev.laptop.org/ticket/10807#comment:7>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list