[Sugar-devel] sugar.datastore
Tomeu Vizoso
tomeu at sugarlabs.org
Sat Feb 28 11:18:46 EST 2009
Hi Sascha,
On Sat, Feb 21, 2009 at 00:24, Sascha Silbe
<sascha-ml-ui-sugar-devel at silbe.org> wrote:
>
> After I fixed the Python search path in Pippy, I'm trying to get the data
> store part of the Slideshow example to work (it doesn't return any objects
> though there are JPEGs in the data store).
> pippy.query seems outdated (uses direct DBus access, datastore is
> complaining about invalid parameters), so I'm trying sugar.datastore
> according to the howto on [1].
> Is sugar.datastore.datastore working properly? It behaves quite unexpectedly
> for me:
>
> 1. datastore.find({'mime_type': 'image/jpeg'}) returns no objects
You have uncovered a bug in datastore.find(), you can work around it
by wrapping the 'image/png' value in an array:
datastore.find({'mime_type': ['image/png']})
Have entered http://dev.sugarlabs.org/ticket/457 about it.
BUT, I'm not sure activities should be using find() at this time as
there are several plans on the table regarding the datastore future
and chances are that the querying interface to the DS will change (or
even disappear) in the next releases as we try to improve
compatibility with non-sugarized apps and try to use bits that are
maintained by other people.
Even then, it may be possible to provide a compatible API, but that
requires that someone finds the time to maintain them.
> 2. datastore.find({'title': 'Browse Activity'}) returns the same as
> datastore.find({}), i.e. probably all entries - but most of them
> don't match the given title
True, the title property has been dropped from the index because the
journal doesn't use it and storing it there affects performance. Get
it back there would be trivial but because of the reasons mentioned
above activities may not access it.
> 3. the metadata entries contain dbus.ByteArray's, not (unicode) strings like
> I'd expect
Yes, activities can store binary data as property vales, not only
textual strings.
> BTW: an items() function would be nice
You mean as in ds_object.metadata.items()?
Thanks,
Tomeu
More information about the Sugar-devel
mailing list