[mod_python] filename for return file_content

Lisický Jiří lisicky at opt.cd.cz
Fri Feb 23 10:09:20 EST 2007


I am using mod_python publisher and I want send tar.gz file to
client. File is not acessible by apache. I am using this code:

def send_file(req):
   req.content_type = "application/x-gzip"
   file = open("/some/path/file.tar.gz").read()
   return file

But problem is, that this file have name as python function, that send
it with extension gz. So send_file.gz. And I need also tar extension.

Is there better way, that copy this file to directory, where apache
see it?

BTW MSIE is also "very funny". If I get http://www/file.tgz MSIE save
it as file.gz - so I must use tar.gz extension. (in firefox no problem)

More information about the Mod_python mailing list