[mod_python] Sendfile & request answer

Dominique.Holzwarth at ch.delarue.com Dominique.Holzwarth at ch.delarue.com
Thu Apr 24 07:27:15 EDT 2008

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... :-/


-----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.


More information about the Mod_python mailing list