Hm, from what I got from the twisted documentation, if you are using request.write() at all, you pretty much have to return NOT_DONE_YET, because the write only actually happens after the function returns.