Commits

Stéphane Klein committed c499dbb

Append yield support in cascade

Comments (0)

Files changed (1)

             try:
                 v = app(environ_copy, repl_start_response)
                 if not failed:
-                    return v
+                    for chunk in  v:
+                        yield chunk
+                    break
                 else:
                     if hasattr(v, 'close'):
                         # Exhaust the iterator first:
                         v.close()
             except self.catch_exceptions, e:
                 pass
-        if copy_wsgi_input:
-            environ['wsgi.input'].seek(0)
-        return self.apps[-1](environ, start_response)
+
+        if failed:
+            if copy_wsgi_input:
+                environ['wsgi.input'].seek(0)
+
+            for chunk in  self.apps[-1](environ, start_response):
+                yield chunk
 
 def _consuming_writer(s):
     pass