URGENT: Serving a File object from an external method.
I want to have a url that returns a binary object that is dynamically generated. I have created an external method with something like the following: from OFS.Image import File f = File('ASGL', 'ASGL', res, content_type='application/octet-stream') return f If I do a print f.content_type I get 'application/octet-stream'. If I do the following (doCommand is the external method): f = urllib.urlopen("http://here.com:9673/doCommand") print f.info() I get the following: Server: ZopeHTTP/1.16 Python/1.5.1 Date: Thu, 01 Jul 1999 01:19:28 GMT Content-Length: 96 Content-Type: text/plain What am I doing wrong? How do I get an dynamically generated binary file?
On Thu, 1 Jul 1999, Jay, Dylan wrote: If your external method is responsible of returning the binary file then something like this might work: def generateFile(self,RESPONSE): ' ' RESPONSE['content-type']='application/octet-stream' bin_data=generate_data() ## the generating function return bin_data Pavlos
participants (2)
-
Jay, Dylan -
Pavlos Christoforou