[mod_python] mod_python.util Supplement function: refresh

Graham Dumpleton grahamd at dscpl.com.au
Tue Jan 24 17:10:34 EST 2006

Sean Jamieson wrote ..
> I've written a supplemental function for the mod_python.util module, 
> similar to mod_python.util.redirect, this is a helper function that sets
> the Refresh header.
> Personally I use Refresh atleast as much Location (redirct), if not more.
> So here it is, in all it's simplicity:
> def refresh(req, time, location=None):
>     """refresh( req, seconds, location=None ) -> None
>     A convenience function to provide refresh/redirection via the HTTP
> Refresh header
>     """
>     if req.sent_bodyct:
>         raise IOError, "Cannot send refresh header after headers have 
> already been sent."
>     req.err_headers_out["Refresh"] = str(seconds) # seconds is usually
> given as an integer
>     if location:
>         req.err_headers_out["Refresh"] += ';url=' + location

If you want to ensure this gets considered at some point, log it as a
new feature/wish at:


Requests like this only posted to the mailing list inevitably get lost
over time.


More information about the Mod_python mailing list