[Sugar-devel] Datastore API for html activities (Daniel Narvaez)

Daniel Narvaez dwnarvaez at gmail.com
Wed May 29 19:49:59 EDT 2013


On 29 May 2013 21:45, <lionel at olpc-france.org> wrote:

> Not fully agree. The easiest activity has just to write a single entry in
> the journal with “standard” metadata and a screen capture. In Python,
> nothing has to be written to create this entry. I guess that it’s why the
> read_file and write_file has been written. So I think we must provide the
> same feature in the HTML DataStore API instead of forcing to create a new
> entry each time.
>

What about an Activity.getDatastoreObject() method?

Any code could use it to add metadata to the object and to set the data.
Activity would fill in some standard stuff and auto-save it when necessary.

I can think of a couple of issues

* I'm  not sure how setMetadata should work exactly. Since getMetadata()
must be async, it would be annoying to go getMetadata(), make changes,
setMetadata(). More importantly you risk to overwrite changes made in other
parts of the code. Maybe we need an updateMetadata instead, which changes
only the specified properties. Not the most common pattern though.
* Rather than having multiple types of objects, TextObject, BlobObject etc,
we would need to have multiple ways to set the data, setAsText, setAsBlob.
But perhaps that's better in any case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130530/a07c7af9/attachment.html>


More information about the Sugar-devel mailing list