[Sugar-devel] chooser/datastore documentation

Sascha Silbe sascha-ml-reply-to-2010-3 at silbe.org
Fri Oct 8 04:48:12 EDT 2010


Excerpts from Walter Bender's message of Fri Oct 08 01:45:21 +0200 2010:

> I am struggling with getting my activities to behave in consistent
> ways when using the chooser and datastore.find() between Sugar 0.84
> and more recent Sugar versions.  (For example, I cannot get find() to
> process mime-type query in 0.84 but it will handle a title query.

You can see the full list in src/carquinyol/indexstore.py (0.90 [1],
0.88 [2], 0.86 [3], 0.84 [4]) resp. src/olpc/datastore/model.py for
0.82 [5].

0.90 (see _QUERY_TERM_MAP and _QUERY_VALUE_MAP):
uid, activity, activity_id, mime_type, keep, timestamp, filesize,
creation_time

0.86-0.88 (see _QUERY_TERM_MAP and _QUERY_VALUE_MAP):
uid, activity, activity_id, mime_type, keep, timestamp

0.84 (see _parse_query):
uid, activity, activity_id, mime_type (list), keep, timestamp (start/end
dict)

0.82 (see defaultModel):
activity, activity_id, mime_type, keep, timestamp, title and a whole
bunch more

So mime_type should work fine in 0.84+ if you pass it as a list.
sugar-datastore 0.86+ is more flexible regarding the contents of the
query dictionary, so what works there does not necessarily work in 0.84.
In particular 0.86+ will do what you expect if you pass a (single) MIME
type as a regular string, but 0.84 requires you to pass a list (containing
a single regular string). Because a string is iterable, 0.84 won't
notice you didn't pass a list and will happily match each individual
character against the MIME type field.

> The exact opposite seems to be true in 0.90.

AFAICT searching (!= sorting) title was never supported for 0.84+.


> Similarly, I cannot get what_filter to work with non-GENERIC mime types,

Yes, I recently filed a ticket about that [6].


> I've searched unsuccessfully for documentation on what works in which
> versions. Does such documentation exist somewhere?

Maybe Bert has documented some of it in the wiki. It would be great if
you could either augment his documentation or create a new one based on
the information above.

Sascha

[1] http://git.sugarlabs.org/projects/sugar-datastore/repos/mainline/blobs/master/src/carquinyol/indexstore.py
[2] http://git.sugarlabs.org/projects/sugar-datastore/repos/mainline/blobs/sucrose-0.88/src/carquinyol/indexstore.py
[3] http://git.sugarlabs.org/projects/sugar-datastore/repos/mainline/blobs/sucrose-0.86/src/carquinyol/indexstore.py
[4] http://git.sugarlabs.org/projects/sugar-datastore/repos/mainline/blobs/sucrose-0.84/src/carquinyol/indexstore.py
[5] http://git.sugarlabs.org/projects/sugar-datastore/repos/mainline/blobs/sucrose-0.82/src/olpc/datastore/model.py
[6] https://bugs.sugarlabs.org/ticket/2400
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101008/50a8033e/attachment.pgp>


More information about the Sugar-devel mailing list