[mod_python] Problems with req.content_type and req.sendfile in IE, but Opera/Mozilla works.

Cliff Cunnington cc-modpy at ccnet.xs4all.nl
Wed Sep 8 16:17:21 EDT 2004


Ole,

* Ole Jacob Hagen <waterthrill at yahoo.no> [2004-09-08 09:34:33 +0200]:

> I need a workaround for the Internet Explorer browser as this code 
> doesn't works:

I guess you're having the problem described here:
    
    http://www.lowagie.com/iText/faq.html#msie

If so, the following might fix it / (untested with MSIE):

> %% snip of my psp-code %%
from os.path import getsize
>    fpdf = PDF_PATH + "/" + "pdf.pdf"
     # MSIE wants to know the content-length of some files (PDF)
     req.set_content_length(getsize(fpdf))
>    req.content_type = 'application/pdf'
     req.send_http_header()
>    req.sendfile(fpdf)
> 
> %% end of snip %%


HTH,


Cliff

 


More information about the Mod_python mailing list