[mod_python] Re: response content-type

StianSøiland stian at soiland.no
Sat Dec 13 19:26:19 EST 2003

On 2003-12-13 13:41:30, Alexiev Nikolay wrote:

> How can I change content-type of respons, using publisher handler ?

Include req as first parameter, and set req.content_type.

def test(req):
    req.content_type = "image/jpeg"
    image = open("/somewhere/blapp.jpeg").read()
    return image

Stian Søiland               Work toward win-win situation. Win-lose
Trondheim, Norway           is where you win and the other lose.
http://www.soiland.no/      Lose-lose and lose-win are left as an
                            exercise to the reader.  [Limoncelli/Hogan]

More information about the Mod_python mailing list