[Twisted-web] Best way to avoid chunked encoding in HTTP Resource response?

Ivan Kozik ivan at ludios.org
Thu Apr 19 13:20:05 EDT 2012

On Thu, Apr 19, 2012 at 15:37, Tom Sheffler <tom.sheffler at gmail.com> wrote:
> Is this the best (or recommended) way to create such a response?

I don't think there's any need to close your StringIO.  You can also
use cStringIO.StringIO for better performance.  And you can just
return a string from your render_GET.  So, like this (untested):

 def render_GET(self, response):
    output = cStringIO.StringIO()
    return output.getvalue()


More information about the Twisted-web mailing list