Re: [Zope-dev] How to return downloadable content from Python Method

2001-06-12 Thread Casey Duncan

 Blandford, Simon [BSS Audio UK] wrote:
 
 I am compressing files which need to be uncompressed inline before
 download. The DTML href=... calles a python method in the product
 which returns the uncompressed file data. Say this file is an MSWord
 document, how do I return this as a file to download? Presently, the
 browser just tries to display the binary file and makes a mess of it.
 
 Regards,
 Simon B.

It probably is not setting the content-type header. Add something like
this to the method that returns the data:

RESPONSE.setHeader('Content-Type', self.content_type)

Where content_type is set to the MIME type of the data, which for MSWord
is 'application/msword'
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] How to return downloadable content from Python Method

2001-06-08 Thread Blandford, Simon [BSS Audio UK]



I am compressing 
files which need to be uncompressed inline before download. The DTML 
href="..." calles a python method in the product which returns the 
uncompressed file data. Say this file is an MSWord document, how do I return 
this as a file to download? Presently, the browser just tries to display the 
binary file and makes a mess of it.

Regards,
Simon 
B.


Re: Fwd: [Zope-dev] How to return downloadable content from Python Method

2001-06-08 Thread Gregor Heine

 I am compressing  files which need to be uncompressed inline 
 before download. The DTML  href=... calles a python method 
 in the product which returns the  uncompressed file data. Say 
 this file is an MSWord document, how do I return  this as a file 
 to download? Presently, the browser just tries to display the 
 binary file and makes a mess of it.
 
 Regards,
 Simon  B. 

Hi Simon,

First off, please don't send HTML mail to the list.

You will have to set the Content-Type HTTP header to do that:
REQUEST.RESPONSE.setHeader('Content-Type', content_type)
where content_type is the right MIME type of the file you return, e.g.
something like 'application/msword' in your case.
Hope  that helps.

Cheers,

Gregor.


-- 
Machen Sie Ihr Hobby zu Geld bei unserem Partner 11!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



RE: Fwd: [Zope-dev] How to return downloadable content from Python Method

2001-06-08 Thread Blandford, Simon [BSS Audio UK]

Hi Gregor,

 First off, please don't send HTML mail to the list.

Ouch! Sorry! Easy mistake to make.

 
 You will have to set the Content-Type HTTP header to do that:
 REQUEST.RESPONSE.setHeader('Content-Type', content_type)
 where content_type is the right MIME type of the file you return, e.g.
 something like 'application/msword' in your case.
 Hope  that helps.

Yes it works! Thankyou for your help.

Much appreciated,
Simon B.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )