Programatically creating folders.
How do I create a folder object programatically? I don't want to user the Zope pull down in manager, I want to have it as a function. John -
On Wed, 21 May 2003 12:21:17 -0400 (EDT), John Kipling Lewis <jklewis@umich.edu> wrote:
How do I create a folder object programatically? I don't want to user the Zope pull down in manager, I want to have it as a function.
John -
yourParentFolderObject.manage_addProduct['OFSP'].manage_addFolder(idForNewFolder) - seb -- Seb Potter Lead Developer Getfrank Limited
On Wed, 21 May 2003, John Kipling Lewis wrote:
How do I create a folder object programatically? I don't want to user the Zope pull down in manager, I want to have it as a function.
The API in the Zope Book is your friend. manage_addProduct['OFSP'].manage_addFolder(id, title) The manage_addProduct is an ObjectManager; manage_addFolder is a constructor. The detailed form depends upon whether you are creating the object is DTML, python, or ZPT. For example, use <dtml-call expr="manage_addProduct...."> from DTML, container.manage_addProduct.... from Python.
Actually, I was mistaken. We've written a Zope product that extends folder. We want to add one of our objects to this extended folder. We assume that 'OFSP' in manage_addProduct would be changed to point to our new product, but are unsure what to call it. ideas? John
The API in the Zope Book is your friend.
manage_addProduct['OFSP'].manage_addFolder(id, title)
The manage_addProduct is an ObjectManager; manage_addFolder is a constructor.
The detailed form depends upon whether you are creating the object is DTML, python, or ZPT. For example, use
<dtml-call expr="manage_addProduct....">
from DTML,
container.manage_addProduct....
from Python.
Actually, I was mistaken.
We've written a Zope product that extends folder. We want to add one of our objects to this extended folder. We assume that 'OFSP' in manage_addProduct would be changed to point to our new product, but are unsure what to call it.
That depends on what your module is called. Say you've written a new product and placed it into your Products folder as: Products/MyProduct/BetterFolder.py and we'll assume that you've kept the constructor as: def manage_addFolder( id, title ) then all you should need to do is call: container.manage_addProduct['MyProduct'].manage_addFolder(id, title) This uses the MyProduct module subscript in the list of installed modules, and calls the manage_addFolder constructor referenced in the __init__.py contained in your module. Hope this makes things a bit clearer, - seb -- Seb Potter Lead Developer Getfrank Limited
John Kipling Lewis wrote:
How do I create a folder object programatically? I don't want to user the Zope pull down in manager, I want to have it as a function.
See ZopeHelp -> Api Reference -> ObjectManager -> First example Cheers, Maik
participants (4)
-
Dennis Allison -
John Kipling Lewis -
Maik Jablonski -
Seb Potter