Adding folders, was: RE: [Zope] (no subject)
sean.upton@uniontrib.com
sean.upton@uniontrib.com
Sun, 30 Mar 2003 10:13:53 -0800
OFSP is a product that comes with Zope that provides the necessary machinery
to allow you to add folders and 'versions' (ZODB versions, which are
long-running-transactions that usually cause more trouble than good) in the
Zope Management Interface. Code in lib/python/Products/OFSP also makes it
possible to use ZClasses to subclass a folder or other classes defined in
lib/python/OFS, as well as use these classes in the ZMI.
If you want to add new folders programmatically, you can call the factory
method defined for Folder from a through-the-web Python Script object:
context[id].manage_addProduct['OFSP'].manage_addFolder(id='123',
title='title')
FYI, if you try to do this and the folder is already there, you will get an
error, for which reason you may want to consider wrapping this in a
try/except pair that deals with any exceptions if you try to run a script
that creates folders (either that, or give your folders meaningfully unique
IDs).
The following google search results might be a starting point for more info
on doing this in other situations where you need to add content
programatically.
http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=zope+adding+programmatical
ly&spell=1
Sean
-----Original Message-----
From: vasanthsena x [mailto:vasanthsena@yahoo.com]
Sent: Sunday, March 30, 2003 8:45 AM
To: zope@zope.org
Subject: [Zope] (no subject)
Can anyone tell me what OFSP is.Also is it possible to
write a python script that adds new folders in zope.
Thanks,
S.
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
_______________________________________________
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 )