← Back to team overview

gtg-contributors team mailing list archive

Re: pushing a relationship from the backend

 

>  Speaking of work in parallel...I ran into *exactly* this problem last
> night while hacking on my own dbus-server branch (which I keep in sync
> by pulling in the liblarch_migration branch periodically).
>
> See:
> http://bazaar.launchpad.net/~gtg-contributors/gtg/dbus-server/revision/855
>
> My approach was what Lionel suggests:
>      * In DataStore.task_factory, a new Task instance (i.e. TreeNode)
>        is added to the tree *immediately* when it is created.
>      * This way, the Task passed to taskxml.task_from_xml() is already
>        associated with a tree, so when add_child() is used, it will not
>        throw exceptions. If the desired child node is not yet loaded
>        (happens often), a pending relationship is created.

>From my "backendish" point of view, that solution is not a good one.
Any internet-based backend will take a few seconds to build a task,
and it can happend that something goes wrong (connection is lost...).
I've written the backends with the idea that if anything went wrong I
could throw away the task easily (because it does not have connections
with any other task yet). Plus, the user would see an empty task pop
up, that after a few seconds gets a title, after a few more a due
date... This means that tasks would "misterously" disappear from the
workview.



Follow ups

References