[Sugar-devel] Is using the datastore.find() function reliable and safe?

Bert Freudenberg bert at freudenbergs.de
Mon Aug 3 05:53:07 EDT 2009


On 03.08.2009, at 01:31, sumit singh wrote:

> Hello all,
>
> I want to save files from my activity so that I can retrieve them from
> the future instances of my activity and also want them to be visible
> in the journal. So, I am planning to save them in the datastore. And
> is planning to retrieve them using the datastore.find() function in
> the future instances of my activity. However, the following link
> mentions -- http://wiki.sugarlabs.org/go/Development_Team/Almanac/sugar.datastore.datastore
> that using the function is not very reliable except with the
> activity_id key.

I don't think that warning is particularly helpful. I'd ignore it.

> As, I want to access all such files with a special property which I
> saved from the previous versions of the activity, I can't just rely on
> the activity_id thing. So, what can be a good solution for it. Would
> using the find function be fine. Kindly give your suggestions. Just
> repeating my requirements-
>
> 1. The files should be visible in the journal.
> 2. They should be accessible from within the future instances of the  
> activity.


'activity_id' is actually the activity instance id, which differs  
whenever you start a fresh copy of the activity, so that's not what  
you want. But using the 'activity' key should work fine, since this is  
your activity's bundle id (e.g. 'my.organization.MyActivity'):

http://wiki.laptop.org/go/Low-level_Activity_API#Meta_Data

- Bert -




More information about the Sugar-devel mailing list