title: Passing data to mod_wsgi
body: <p>In mod_wsgi I send the headers by running the function start_response(), but all the page content is passed by yield/return. Is there a way to pass the page content in a similar fashion as start_response()? Using the return.yield statement is very restrictive when it comes to working with chunked data.</p>
  
  <p>E.g.</p>
  
  <pre><code>def Application():
  
      b = buffer()
  
      [... page code ...]
  
      while True:
          out = b.flush()    
          if out:
              yield out
  
  class buffer:
  
      def __init__(self):        
          b = ['']
          l = 0
  
      def add(self, s):
          s = str(s)
          l += len(s)
          b.append(s)
  
      def flush(self):
  
          if self.l &gt; 1000:
              out = ''.join(b)
              self.__init__()
              return out
  </code></pre>
  
  <p>I want to have the buffer outputting the content as the page loads, but only outputs the content once enough of it has piled up (in this eg. 1000 bytes).</p>