How to prevent a shared document from downloading more than once?

James Simmons jim.simmons at
Mon Mar 16 14:09:24 EDT 2009

Great, once again I'm going to be indebted to Aleksey Lim.  I'll give a try as soon as I can.

James Simmons

Wade Brainerd wrote:
> I wrote a brief proposal a few weeks ago for an improvement to the
> collab API that might help this problem.  The discussion is in
>  Aleksey Lim wrote an example
> implementation of this Cartoon Builder.
> The idea is that rather than having overlapping entry points for
> intializing activity instances: __init__ (new instance but all the
> others also), read_file (resume instance), shared_cb (join, share
> instance) we have a new set of callbacks which are invoked *after*
> __init__.
> new_instance
> resume_instance
> share_instance(is_initiator) - could be split into join_instance and
> share_instance?
> save_instance
> alsroot's implementation is below, and it calls the old interfaces
> when they are not present.
> Perhaps these new callbacks could be integrated into Sugar 0.86?  But
> in the meantime, you can always just add Aleksey's into your
> activity.
> Cheers,
> Wade
> On Mon, Mar 16, 2009 at 11:29 AM, James Simmons
> <jim.simmons at> wrote:
>> It looks like my last naive question about collaboration started a
>> discussion so notable that Walter Bender wrote about it in his blog
>>  Let's see what you can do with this one.
>> Both my Activities, Read ETexts and View Slides, have document sharing
>> code mostly copied from the core Read activity.  Currently this works
>> just fine in both Activities, with only one problem.  Suppose someone
>> shares a document with me, I receive it successfully, then quit, causing
>> the copied document to be saved in my Journal.  Now if the original user
>> stops sharing (closes his copy of the Activity) and I resume mine I get
>> my stored copy and all is wonderful.  But suppose the original user
>> *doesn't* stop sharing.  I resume my copy, see the stored copy on the
>> screen, but I *still* download the document my friend is sharing.  I
>> don't want to do that.  It wastes bandwidth and time and causes *keep*
>> errors when you close the document.
>> Now the problem is, the sharing code is in the __init__() method, which
>> always runs before anything else, and the read_file() method, which runs
>> when you resume from the Journal, unfortunately *after* the Activity has
>> already decided it needs to download the file.  I need a way for the
>> __init__ method to realize that it doesn't need to download the file, or
>> some other way to deal with the problem.
>> Thanks,
>> James Simmons
>> _______________________________________________
>> Devel mailing list
>> Devel at

More information about the Devel mailing list