Ticket #1609 (new defect)

Opened 3 years ago

Last modified 3 years ago

sugar.datastore.datastore.find(): async mode broken

Reported by: sascha_silbe Owned by: erikos
Priority: Unspecified by Maintainer Milestone: Unspecified by Release Team
Component: sugar-toolkit Version: Git as of bugdate
Severity: Blocker Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: New

Description

sugar.datastore.datastore.find() leads the API consumer into believing it supports asynchronous operation by offering the reply_handler and error_handler parameters, but it breaks if those are used:

>>> sugar.datastore.datastore.find({'foo': 'bar'}, reply_handler=cb, error_handler=cb)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/datastore/datastore.py", line 277, in find
    reply_handler, error_handler)
TypeError: 'NoneType' object is not iterable
>>> 

This has been fixed during my data store access refactorings (#1197), but since those have not been merged it's still broken.
How should we go forward on it? Three options come to my mind:

1. Merge #1197 / #1198 (we're now more early in the release cycle).
2. Backport this single change from #1197.
3. Remove reply_handler and error_handler parameters to indicate asynchronous operation isn't supported.

I'm marking this Blocker instead of just Major because I noticed it when I wanted to use asynchronous mode from within an activity.

Change History

Changed 3 years ago by sascha_silbe

The situation has changed: While the traceback doesn't happen anymore, find() will return different things in synchronous vs. asynchronous mode. For sync it returns DSObjects, for async the raw data store D-Bus call results.

Note: See TracTickets for help on using tickets.