[Sugar-devel] chooser/datastore documentation
Walter Bender
walter.bender at gmail.com
Fri Oct 8 05:28:33 EDT 2010
On Fri, Oct 8, 2010 at 4:48 AM, Sascha Silbe
<sascha-ml-reply-to-2010-3 at silbe.org> wrote:
> 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.
Thanks. I'll write a test program to confirm all of the above and put
the results in the wiki.
-walter
>
> 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/
>
> _______________________________________________
> 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
More information about the Sugar-devel
mailing list