[mod_python] Sendfile & request answer

Clodoaldo clodoaldo.pinto.neto at gmail.com
Thu Apr 24 07:56:01 EDT 2008

2008/4/24, Dominique.Holzwarth at ch.delarue.com
<Dominique.Holzwarth at ch.delarue.com>:
> Well, is there a way to send out more than _one_ response? Like, sending the file first and right after sending the html page or so?
>  I've tried the 'internal_redirect' as in the manual there's written:
>  internal_redirect( new_uri)
>  Internally redirects the request to the new_uri. new_uri must be a string.
>  The httpd server handles internal redirection by creating a new request object and processing all request phases. Within an internal redirect, req.prev will contain a reference to a request object from which it was redirected.
>  So I thought by calling req.internal_redirect() after req.sendfile() I would get another request for which I could generate my html page answer. But that didn't seem to work... :-/

I would consider the use of ajax although i don't know if it will
work. First request the file and then the page. I never did it but i
think it is worth the investigation.

Regards, Clodoaldo

>  -----Original Message-----
>  From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
>  Sent: Donnerstag, 24. April 2008 13:22
>  To: Holzwarth, Dominique (Berne Bauhaus)
>  Cc: mod_python at modpython.org
>  Subject: Re: [mod_python] Sendfile & request answer
>  2008/4/24  <Dominique.Holzwarth at ch.delarue.com>:
>  > Hi everyone!
>  >
>  >  I'm using the publisher handler for a web application that consist of a html page with a form. On a button click I'm sending a file to the client (so the client can open/save that file). But when I do the req.sendfile() I can't send a 'normal' request answer (a html page) to the client anymore using 'return "some html string"' or 'req.write("html string")'.
>  >
>  >  Is there any way to send a file to the user AND refresh the displayed html page?
>  Within the one response, no.
>  At least this is the case if using req.sendfile(). The only way would be by sending a multipart/mixed response, but then you would most likely need a special client to be able to pull it apart which would generally make it impractical.
>  Graham
>  _______________________________________________
>  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