In WSGI, send response without returning

Is there any way to wrap a WSGI application method such the server will send a response when a particular method is called, rather than when the application method returns a sequence?

Basically, I'd like to have the equivalent of a finish_response(responseValue) method.

-------------Problems Reply------------

WSGI app must return an iterable, one way or another. If you want to send partial responses, turn your application into a generator (or return an iterator):

import wsgiref, wsgiref.simple_server, time

def app(environ, start):
start('200 OK', [('Content-Type', 'text/plain')])

yield 'hello '
yield 'world'

httpd = wsgiref.simple_server.make_server('localhost', 8999, app)

Category:python Views:0 Time:2011-11-07
Tags: python wsgi

Related post

Copyright (C), All Rights Reserved.

processed in 0.158 (s). 11 q(s)