[Zope] Download counter - only successful downloads

Danny William Adair danny@adair.net
Tue, 6 Nov 2001 09:49:06 +1300


I would also like to implement a download counter.
Is there any realistic way of having it count only files that have been 
_successfully_ and _fully_ downloaded? I know there is a "precondition" for 
file objects (that can do whatever, e.g. increase a counter), but is there 
something like a postcondition?

I am not sure if this is actually possible, but my feeling is yes.

Thanks for your help,
Danny

On Tuesday 06 November 2001 00:43, Paul Zwarts wrote:
> Hi,
>
> You could do it that way, but wouldn’t that mean that when you load the
> page, the link itself will increase the counter whether or not you
> followed that link, making it ineffective. On our website, I use a
> query_string that runs a method that increases and THEN fetches the URL,
> rather than being direct. That way you can also mask the the actual
> address is necessary. You can check it out in the Links section of our
> site:
>
> www.oratrix.com
>
> It may give you an idea or two....
>
> Best regards,
> Paul Zwarts
>
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of
> e-Musty
> Sent: Monday, November 05, 2001 11:23 AM
> To: zope@zope.org
> Subject: [Zope] Download counter
>
> Could anyone tell me how to implement a very single download counter?
>  
> I mean the followings:
> Assume you have a folder named media with subfolders such as audio,
> video, pic. All subfolderes might have another subfolders, e.g. mp3,
> wav, ra for audio etc. All folder might have files, not just the lowest
> one.
>  
> The tricky thing I cannot figure out is how to write a script able to
> maintain download counts.
>  
> What I've tried is that I've made the following change to my ZCatalog's
> search result page:
>  
> <dtml-in aCatalogue>
>   <a href="fileDownload('<dtml-var sequence-item>')">title_or_id</a><br>
> </dtml-in>
> where fileDownload would be a Python script doing the stuff by checking
> the file's properties. If the file in question has a dwc attribute, it
> increases its value by one, if does not have, it creates the dwc
> property and sets its value to 1.
> The problem is that I cannot reach the object passed to the script. The
> question is, how to access that passed File object from Python. Can
> anyone help me?
>  
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )