[mod_python] Sending files

SAiello at Jentoo.com SAiello at Jentoo.com
Mon Jan 17 06:11:03 EST 2005


Thanks for the pointer, I missed that method in the documentation...

On Monday 17 January 2005 07:12 am, Nicolas Lehuen wrote:
> Hi,
>
> I've never tried it, but have a look at the req.sendfile() method :
>
> http://www.modpython.org/live/current/doc-html/pyapi-mprequest-meth.html
>
> "This function provides the most efficient way to send a file to the
> client."
>
> Regards,
> Nicolas
>
>
> On Mon, 17 Jan 2005 05:36:59 -0500, SAiello at Jentoo.com
>
> <SAiello at jentoo.com> wrote:
> > Hello All,
> >
> > I was wondering if there was a better way to send file through mod_python
> > than:
> >
> > file=open('example.mp3', 'r')
> > req.conent_type='audio/mpeg'
> > req.write(file.read())
> > file.close()
> >
> > Just from the simple use I have done, this manner of sending files seems
> > to be slow. Any suggestions ?
> >
> > Thanks,
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list