[Zope] Upload to a subfolder using an External Method
Tino Wildenhain
tino@wildenhain.de
Mon, 05 Nov 2001 13:20:34 +0100
Hi Adam,
--On Monday, November 05, 2001 22:25:13 +1300 Adam Warner
<lists@consulting.net.nz> wrote:
> Hi all,
>
> This is the relevant part of my Python External Method that uploads an
> HTML file called output.xhtml to the current folder (and is given the
> name id).
>
> newfile=open('output.xhtml','r')
> newfile.seek(0)
> self.manage_addFile(id,newfile,content_type='text/html')
> newfile.close()
>
> I would instead like to upload to a pre-existing subfolder called
> 'cached' (although creating a folder would be no big deal:
> self.manage_addFolder(...)). I haven't found an applicable command in
> the Zope Quick Reference to change the current Zope directory:
>
> http://www.zope.org/Members/ZQR
> http://www.zope.org/Members/ZQR/zqr/printable
>
> I imagine the command would look something like
> self.manage_changeFolder('cached')
>
No. There is nothing like "the current folder" or something
like that. ZOPE consists of a pile of objects - or more precisely
a tree of objects. So if you have a method like yours above,
self is simply a reference to an object in the tree.
Any sibling is referenced by name.
If your folder-object is called "cached", you can access its
method manage_addFile() like
that:
self.cached.manage_addFile()
HTH
Tino Wildenhain