precondition with File: Python Script does not work ?
Hi I have a page with downloadable files and wish to count the downloads. I found a 'precondition'-option with the File object. This presummably calls the Method or Document specified before download wil start. The precondition is: counter_download(thefile='zip') In the same folder I have specified the counter_download as a Python Script: parameter: thefile if thefile=='doc': context.manage_changeProperties(doc_downloads=context.getProperty ('doc_downloads')+1) if thefile=='zip': context.manage_changeProperties(zip_downloads=context.getProperty ('zip_downloads')+1) return "ok" And the same folder also has these properties defined. The Python Script works fine when I test it and also the downloads are ok. However, the counting does not happen ?! Any ideas ? Regards Gijs
Hi, --On Montag, 30. Juli 2001 09:41 +0000 greulen@freeler.nl wrote:
Hi
I have a page with downloadable files and wish to count the downloads. I found a 'precondition'-option with the File object. This presummably calls the Method or Document specified before download wil start. The precondition is: counter_download(thefile='zip')
From what I know precondition can only be the name of a method, not method with calling args.
HTH Tino Wildenhain PS: if you want to count your downloads - why not using a webanalyzer tool with your logs? Many updates in the ZODB is a bit costy anless you are using non undoable storage.
In the same folder I have specified the counter_download as a Python Script:
parameter: thefile
if thefile=='doc': context.manage_changeProperties(doc_downloads=context.getProperty ('doc_downloads')+1) if thefile=='zip': context.manage_changeProperties(zip_downloads=context.getProperty ('zip_downloads')+1) return "ok"
And the same folder also has these properties defined.
The Python Script works fine when I test it and also the downloads are ok. However, the counting does not happen ?! Any ideas ?
Regards Gijs
_______________________________________________ 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 )
From what I know precondition can only be the name of a method, not method with calling args.
Hmmm. Could be, I will test that.
HTH Tino Wildenhain PS: if you want to count your downloads - why not using a webanalyzer tool with your logs? Many updates in the ZODB is a bit costy anless you are using non undoable storage.
Because I would to create a nicely formatted page for myself with the download stats. Callable from any browser in the world. Thats what I like about Zope ;-) But costly it is; with heavier use I will store the values outside of Zope. Regards Gijs
Take a quick look at FSCounter, will allow you to do this without the overhead, mind you web logs are really the way to go. ----- Original Message ----- From: "Gijs" <greulen@freeler.nl> To: "Mailinglist Zope" <zope@zope.org> Sent: Monday, July 30, 2001 5:37 AM Subject: RE: [Zope] precondition with File: Python Script does not work ?
From what I know precondition can only be the name of a method, not method with calling args.
Hmmm. Could be, I will test that.
HTH Tino Wildenhain PS: if you want to count your downloads - why not using a webanalyzer tool with your logs? Many updates in the ZODB is a bit costy anless you are using non undoable storage.
Because I would to create a nicely formatted page for myself with the download stats. Callable from any browser in the world. Thats what I like about Zope ;-) But costly it is; with heavier use I will store the values outside of Zope.
Regards Gijs
_______________________________________________ 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 )
participants (4)
-
Andy McKay -
Gijs -
greulen@freeler.nl -
Tino Wildenhain