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

James Simmons jim.simmons at walgreens.com
Mon Mar 16 17:14:45 EDT 2009


Gary,

I'm going to try your suggestion first, since it seems like something I 
could do with just a couple of lines.

I'm remembering another problem I have with my stuff, which is how to 
give a shared document the correct name in the Journal that receives 
it.  In the Read activity it seems it is getting the title of the 
document from metadata in the PDF file itself, which I cannot do because 
my documents are just Zip files or text files.  So my Journal entry 
reads "Read EText Activity" or "View Slides Activity".

This is what I want to happen:

1).  Someone has a document to share, say the book "Jack and the 
Giants", which is a zip file containing scanned in images.  He goes to 
the neighborhood view and sees his friend Billy is there, and he invites 
Billy to share the book.

2).  Billy goes into his own neighborhood view and sees the View Slides 
icon, indicating that someone has a slide collection to share.  He 
mouses over the icon and sees that the collection is named "Jack and the 
Giants."  Sounds cool.  He clicks on the icon and starts receiving the 
book.  When it is fully downloaded he reads it a bit, then exits the 
View Slides Activity.

3).  The next time he goes to the Journal he sees an entry with the 
"View Slides" icon named "Jack and the Giants".

I know how to update the Journal title from Python.  The missing piece 
is how do I find out the name of the shared document?  It shows the name 
when we invite Billy to share it, so how do I get that name?

James Simmons



Gary C Martin wrote:
> On 16 Mar 2009, at 15:29, James Simmons wrote:
>
>> It looks like my last naive question about collaboration started a
>> discussion so notable that Walter Bender wrote about it in his blog
>> http://walterbender.org/.  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.
>
> Sorry, I'm likely missing something obvious here, but could the 
> __init__() check to see if it was resumed from journal, and use that 
> as a cue to read the local file? If the file is incomplete/corrupt 
> you'd need back out and get the file remotely:
>
>     if handle.object_id == None:
>         # Launched from home.
>         ... ...
>     else:
>         # Journal resume, don't download, use local file.
>         ... ...
>
> Regards,
> --Gary
>
> P.S. This coming from a man who hasn't implemented collaboration in 
> any of his activities yet.
>
>> Thanks,
>>
>> James Simmons
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.laptop.org
>> http://lists.laptop.org/listinfo/devel
>





More information about the Devel mailing list