how can I get at the content of a file
Hi, I would like to write the content of a cmf file object (or image) to a file to process it. how can I get at the content of the file in a script? I tried something like content = object.index_html(REQUEST, RESPONSE) but that tries to download the file from the server and does not return its content. thanks for your help Robert
document_src() eg: content = object.document_src() robert rottermann wrote:
Hi, I would like to write the content of a cmf file object (or image) to a file to process it. how can I get at the content of the file in a script? I tried something like content = object.index_html(REQUEST, RESPONSE) but that tries to download the file from the server and does not return its content.
thanks for your help Robert
_______________________________________________ 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 )
content = image_or_file_object.data Ausum ----- Original Message ----- From: "robert rottermann" <robert@redcor.ch> To: <zope@zope.org> Sent: Wednesday, November 13, 2002 6:12 PM Subject: [Zope] how can I get at the content of a file Hi, I would like to write the content of a cmf file object (or image) to a file to process it. how can I get at the content of the file in a script? I tried something like content = object.index_html(REQUEST, RESPONSE) but that tries to download the file from the server and does not return its content. thanks for your help Robert _______________________________________________ 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 )
content = image_or_file_object.data
For large files, data is a linked list of chunked content to avoid memory bloat. If you want the whole file and screw the memory bloat you can str it: content = str(image_or_file_object.data) -- Andy McKay www.agmweb.ca
participants (4)
-
Andy McKay -
Ausum Studio -
Chris Beaven -
robert rottermann