[Zope] Changing context in Python Script

Bakhtiar A Hamid kedai@kedai.com.my
Thu, 16 May 2002 16:11:10 +0800


On Thursday 16 May 2002 03:33 pm, Dan Shafer wrote:
> Given the need for a Python script to:
>
> a. create a new folder whose name is stored in a variable called folder=
Name
> b. within that folder create a new doc whose name is stored in a variab=
le
> called docName
>
> what is the appropriate syntax? I can see that I need to change the con=
text
> but I can't find anything on how to do that.
>
> Thanks.
>
#parameter list folderName docname
o=3Dcontext
o.manage_addProduct['OFSP'].manage_addFolder(folderName)

folder =3D getattr(context, foldername)
folder.manage_addProduct['OFSP'].manage_addDTMLDocument(docName)

oughta work

>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--=20

=09http://www.kedai.com.my/             http://www.kedai.com.my/eZine
=09http://www.zope.org/Members/kedai    http://www.my-zope.org
=09As you woke this morning, and open up your eyes... did you notice the =
tear=20
stains lining your face were mine.