Hello, I have a very basic script to write and I facing the some difficulties to understand the Zope Api. My problem is the following : I have tones of photo in several PhotoAlbums that do not have the correct permision. I want to allow only a specific role to view those photos. I found out how to do it in interactive mode, using (instance:8080/manage), but with this method is way too long so I have decided to write a script that will recursively change the permision on all the photo in a branch of my web site tree. So far I already play around in "spe" and get the following: ++++++++++++++++++++++module++++++++++++++++++++++++++ #! /usr/bin/env python import os, sys sys.path.append("/usr/lib/zope/lib/python") import Zope Zope.configure("/home/yml/myZopeInstances/sitePerso/etc/zope.conf") app = Zope.app() #app.sitePerso.Albums.Photo_Album_la.get("Photo_Album.Apt") ------------------In Shell------------------------------------------------------------- appart = app.sitePerso.Albums.Photo_Album_la.get("Photo_Album.Apt") albumsChantier = appart.get("Photo_Album.chantier") chant3 = albumsChantier.get("Photo_Album.chan3")
chant3.objectItems()
[('Chantier 052.jpg', <Photo at /sitePerso/Albums/Photo_Album_la/Photo_Album.Apt/Photo_Album.chantier/Photo_Album.chan3/Chantier 052.jpg>), ('Chantier 053.jpg', <Photo at /sitePerso/Albums/Photo_Album_la/Photo_Album.Apt/Photo_Album.chantier/Photo_Album.chan3/Chantier 053.jpg>), ... cut.... ]
photo = chant3.get('Chantier 053.jpg') photo.manage_permission("View", "MyRole",1) I have several questions concerning this code: How can I check, by script, that I have done a modification on the permission? Please I am stuck And I do not know where to search I have googled the whole evening without any success. Thank you for your help.