[Zope] Changing context in Python Script
Maik Jablonski
maik.jablonski@uni-bielefeld.de
16 May 2002 10:00:52 +0200
On Thu, 2002-05-16 at 09:33, Dan Shafer wrote:
> Given the need for a Python script to:
>
> a. create a new folder whose name is stored in a variable called folderName
> b. within that folder create a new doc whose name is stored in a variable
> called docName
>
> what is the appropriate syntax? I can see that I need to change the context
> but I can't find anything on how to do that.
hi,
use something like this:
# create Folder in context
context.manage_addFolder(folderName)
folderObj=getattr(context,folderName)
# create DTMLDoc in new folder
folderObj.manage_addDTMLDocument(docName)
docObj=getattr(folderObj,docName)
... from here you can manipulate docObj ...
regards, maik
--
maik jablonski http://www.sachunterricht-online.de
universitaet bielefeld http://www.zfl.uni-bielefeld.de
zentrum fuer lehrerbildung tlph://+49.(0).521.106.4234