[Zope] New Product Help
J Cameron Cooper
Wed, 12 Mar 2003 15:41:27 -0600
>I said exactly what I am trying to do. I need a program that creates a root folder in Zope. I need a function in that program to be called to authorized access to that folder.
>I would like to create this in some way without modifying the core code for Zope. I don't know whether that means I need a product or interface or something else.
>I would appreciate some help with this.
A point of terminology, just to make sure we're communicating the same
concepts: there is and can only be only one root in a Zope installation.
You cannot have more than one in an installation. Dead impossible.
Perhaps you can understand why it's confusing to say you want to add a
"root folder". If what you're aiming for is a direct child of that root,
a top-level folder, if you will, that's not so tough.
E.g. say we have the following:
/ (the root)
folder1, folder2, folder3, and object1 are all children of the root, or
top-level objects. They are what you see when you look at
http://localhost/manage . The rest are not.
If what you want to do is be able to create some folder on the same
level as folder1, and also have a method to do something to it, all you
Python Script folderCreate
parameters: id, title
# you can do whatever else you need to do here,
# like restrict permissions
return "Folder " + id + " created" # you can also return the rendering
of some object or do a redirect here
Put this in the highest level you're operating on (in this case the
root), and you can call it to create your folder in whatever context you
call it on. In an HTML form, an action of "/folderCreate" along with id
and title parameters would create a folder with your id and title in the
root. An action of /folder1/folderCreate would make the folder a child
of folder1. The equivalents in Python Scripts would be
root.folderCreate(id,title), and root.folder1.folderCreate(id,title).
You can make a similar Python Script to manipulate security. You might
change the permission for a certain role or add a local role or whatever
it is you want to do.
This could also be a Product: subclass Folder, override Folder's
security with your settings, have the manage_add... set up whatever else
you need, and add a method that changes that security. You could then
call manage_add... directly or through the ZMI to make your new type of