[mod_python] mod_python and mod_wsgi

Gert Cuykens gert.cuykens at gmail.com
Sat Jul 28 20:31:45 EDT 2007


On 7/29/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> On 29/07/07, Gert Cuykens <gert.cuykens at gmail.com> wrote:
> > How do you do this in wsgi :)
> >
> > def handler(req):
> >     text = req.read()
> >     req.content_type = 'text/xml'
> >     req.write(text)
> >     return apache.OK
>
> Try:
>
> def application(environ, start_response):
>     status = '200 OK'
>
>     length = int(environ.get('CONTENT_LENGTH', '0'))
>     output = environ['wsgi.input'].read(length)
>
>     response_headers = [('Content-type', 'text/plain'),
>                         ('Content-Length', str(len(output)))]
>     start_response(status, response_headers)
>
>     return [output]
>
> I didn't use text/xml though so I could actually see posted input and
> not have browser do something strange.

Alrigdy mod_python is going to have to make some room for wsgi,
In fact my next question would be can my wsgi project be in your
example list when its done :)

I only need a new name for my project because dfo is taken in google
code ***** any suggestions ?


More information about the Mod_python mailing list