[Zope] Current Folder

Jonathan Hobbs toolkit at magma.ca
Mon Sep 20 07:40:17 EDT 2004


----- Original Message -----
From: "Gregory Gehrich" <greggehrich at yahoo.com>
> I want to use a Python script within Zope to create a document.  If I
> have a folder that I want to create it in--no problem, I use getattr and
> use the name of the folder.
>
> The problem occurs if I want to use the current directory instead.  What
> is need is to use something like getattr with the current directory name.


This should work:

#create a DTML Document in the same folder as this python script is running
in
context.manage_addDTMLDocument('newDoc', 'newTitle')

#get the new object
ndoc=context.restrictedTraverse('newDoc')

#stick some text into the document
docContents='Some text'
ndoc.manage_edit(docContents, 'aNewTitle')

return 'All Done'


HTH

Jonathan




More information about the Zope mailing list