X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=python%2Fashd-wsgi;h=dc3bc91cd6a9de81c6816ddb736b2ee40eb1db09;hb=699754de7dc11275d9d94eb521111609a6d73ed7;hp=d3347658ff4898d07a76c939f80d18045aa2c201;hpb=4d7cf6cba43bf1dc072b571d1b62cf214d9a7a10;p=ashd.git diff --git a/python/ashd-wsgi b/python/ashd-wsgi index d334765..dc3bc91 100755 --- a/python/ashd-wsgi +++ b/python/ashd-wsgi @@ -74,9 +74,7 @@ def dowsgi(req): resp = [] respsent = [] - def write(data): - if not data: - return + def flushreq(): if not respsent: if not resp: raise Exception, "Trying to write data before starting response." @@ -86,6 +84,11 @@ def dowsgi(req): for nm, val in headers: req.sk.write("%s: %s\n" % (nm, val)) req.sk.write("\n") + + def write(data): + if not data: + return + flushreq() req.sk.write(data) req.sk.flush() @@ -106,7 +109,8 @@ def dowsgi(req): try: for data in respiter: write(data) - write("") + if resp: + flushreq() finally: if hasattr(respiter, "close"): respiter.close()