[Sugar-devel] sugar-web - API for storing data

Suraj K S suraj.gillespie at gmail.com
Fri Aug 16 10:29:49 EDT 2013


+1 to Subscribing read and write functions in activity.setup()

I'll chip in as well once I'm done with the Object Chooser api part.


On 16 August 2013 19:34, Walter Bender <walter.bender at gmail.com> wrote:

> On Fri, Aug 16, 2013 at 8:01 AM, Manuel Quiñones <manuq at laptop.org> wrote:
> > This is one of the most important APIs we will have, so I would
> > like to open discussion on it.
> >
> > In GTK activities, the activity developer subclass Activity, and
> > override read() and write() methods.
> >
> > In web activities, we don't have that kind of hierarchy.  Instead, the
> > activity developer imports 'activity/activity' module, and calls
> > activity.setup() .  Then she/he can use activity.getDatastoreObject()
> > to read and write.
> >
> > In GTK activities, 'read' is called at startup and 'write' is called
> > when the activity goes to the background or when it stops.  Recently,
> > I added in sugar-web those notifications, with the intention to make
> > web activities behave like GTK ones.
> >
> > I provided an initial patch and dnarvaez proposed another option:
> > https://github.com/sugarlabs/sugar-web/pull/74
> >
> > So we can:
> >
> > - Let web developers connect to the 'pause' and 'stop' notifications,
> >   and use the activity datastore object directly. Pro: is more
> >   flexible.  Con: more work in the activity side: error handling,
> >   datastore object handling.
> >
> > - Subscribe 'read' and 'write' functions in activity.setup() .  They
> >   will be called as expected, like in GTK.  'read' will have a JSON
> >   string as argument.  'write' must return a JSON string.  Pro:
> >   simpler approach.  Con: less flexibility in the activity side.  A
> >   mockup can be found in this comment:
> >
> https://github.com/manuq/sugar-web/commit/3c2420f59c9aa8df44d2c0d639fe37b4af63f9fb#commitcomment-3872770
> >
> > Thoughts?  Any other ideas?
>
> Re read/write for JS, I think the solution has been sufficiently
> flexible for our Python activities. While I appreciate the flexibility
> of Not sure of connecting to pause and stop notifications, is there a
> use case where this is necessary or advantageous? Plus we need read in
> both scenarios.
>
> >
> >
> > --
> > .. manuq ..
> > _______________________________________________
> > Sugar-devel mailing list
> > Sugar-devel at lists.sugarlabs.org
> > http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
>
> --
> Walter Bender
> Sugar Labs
> http://www.sugarlabs.org
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130816/46beee1b/attachment.html>


More information about the Sugar-devel mailing list