Unrestricted threads
Hi, I use Zope-2.9.9. I need to create custom "cron like" threads in an application to handle administrative tasks. Global setup of these threads is already OK. So my question is : how can I setup these threads so that they can handle database objects in an unrestricted way (eventually throught an authentication mecanism) ? Thanks for any help, Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : thierry.florac@onf.fr Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85
Hello Thierry, To schedule cron-like tasks on Zope, I use ZpCron: http://www.zope.org/Members/janik/ZpCron It works pretty fine (well, as far as you do not use ZEO) and it allows to define the user you want to use to run such or such task, and the Zope security mechanisms are applied just like if the user had run the task himself. Normally, the user is supposed to be in the Zope root acl_users, but a colleague of mine had proposed a patch (which is published in beta 080314) which allows to use a user define the path of the acl_users you want to use. Regards, -- Eric BREHAULT Makina Corpus www.makina-corpus.com Agence de Toulouse - 09 64 36 57 57 On Tue, Jul 22, 2008 at 7:23 PM, Thierry Florac <thierry.florac@onf.fr> wrote:
Hi,
I use Zope-2.9.9. I need to create custom "cron like" threads in an application to handle administrative tasks. Global setup of these threads is already OK.
So my question is : how can I setup these threads so that they can handle database objects in an unrestricted way (eventually throught an authentication mecanism) ?
Thanks for any help,
Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : thierry.florac@onf.fr Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Le mardi 22 juillet 2008 à 19:43 +0200, Eric Bréhault a écrit :
Hello Thierry,
To schedule cron-like tasks on Zope, I use ZpCron: http://www.zope.org/Members/janik/ZpCron
It works pretty fine (well, as far as you do not use ZEO) and it allows to define the user you want to use to run such or such task, and the Zope security mechanisms are applied just like if the user had run the task himself.
Hi, Thanks for the link... but I use ZEO :-( Anyway, the information was very useful because this product contains all the security related code that I was looking for... Many thanks, Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : thierry.florac@onf.fr Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85
yes indeed you can easily extract the mechanism to create a specific security manager and create a request to call the method you want using this security manager the problem with ZEO is not related to this aspect so it should work fine eric On Wed, Jul 23, 2008 at 11:05 AM, Thierry Florac <thierry.florac@onf.fr> wrote:
Le mardi 22 juillet 2008 à 19:43 +0200, Eric Bréhault a écrit :
Hello Thierry,
To schedule cron-like tasks on Zope, I use ZpCron: http://www.zope.org/Members/janik/ZpCron
It works pretty fine (well, as far as you do not use ZEO) and it allows to define the user you want to use to run such or such task, and the Zope security mechanisms are applied just like if the user had run the task himself.
Hi,
Thanks for the link... but I use ZEO :-( Anyway, the information was very useful because this product contains all the security related code that I was looking for...
Many thanks,
Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : thierry.florac@onf.fr Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric Bréhault wrote:
yes indeed you can easily extract the mechanism to create a specific security manager and create a request to call the method you want using this security manager
the problem with ZEO is not related to this aspect so it should work fine
eric
On Wed, Jul 23, 2008 at 11:05 AM, Thierry Florac <thierry.florac@onf.fr> wrote:
Le mardi 22 juillet 2008 à 19:43 +0200, Eric Bréhault a écrit :
Hello Thierry,
To schedule cron-like tasks on Zope, I use ZpCron: http://www.zope.org/Members/janik/ZpCron
It works pretty fine (well, as far as you do not use ZEO) and it allows to define the user you want to use to run such or such task, and the Zope security mechanisms are applied just like if the user had run the task himself.
Note that you can write scripts designed to use the ZODB, but be run from a crontab. E.g.: $ cat Products/foo/scripts/send_report.py mailnost = app.site.MailHost catalog = app.site.portal_catalog() .... $ crontab -l 55 0 * * * /home/tseaver/instance/bin/zopectl run \ #(no linebreak!) /home/tseaver/instance/Products/foo/scripts/send_report.py You can *only* use this approach if you use ZEO, of course. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIh06c+gerLs4ltQ4RAuJAAKCWoSwiWxmtxqszfwPK6o4c5EKPSACgitdD yqCYwcEekqscJM3bwl1sUiQ= =boKO -----END PGP SIGNATURE-----
Tres Seaver wrote:
Note that you can write scripts designed to use the ZODB, but be run from a crontab. E.g.:
$ cat Products/foo/scripts/send_report.py mailnost = app.site.MailHost catalog = app.site.portal_catalog() ....
$ crontab -l 55 0 * * * /home/tseaver/instance/bin/zopectl run \ #(no linebreak!) /home/tseaver/instance/Products/foo/scripts/send_report.py
You can *only* use this approach if you use ZEO, of course.
...and if you want lots of helper stuff for this kind of operation, you can use stepper: http://www.simplistix.co.uk/software/zope/stepper cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (4)
-
Chris Withers -
Eric Bréhault -
Thierry Florac -
Tres Seaver