Upload to a subfolder using an External Method
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') I know it sounds easy but I'm stumped. Perhaps this has to be done in a Python Script after the file has been uploaded to the Zope database? Many thanks, Adam PS: I'm really happy because Debian Unstable now contains the latest versions of Zope and Python. Thanks Gregor Hoffleit :-)
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
On Tue, 2001-11-06 at 01:20, Tino Wildenhain wrote:
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()
Thank you Tino I really appreciated the explanation that accompanied the answer. I am beginning to achieve enlightenment. BTW everyone, the BOFH takes on Content Management Systems: http://www.theregister.co.uk/content/30/22650.html Regards, Adam
participants (2)
-
Adam Warner -
Tino Wildenhain