[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - Publish.py:1.164.2.2.6.1

Chris McDonough chrism at plope.com
Sun Mar 21 14:42:26 EST 2004


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv12457

Modified Files:
      Tag: chrism-publishfile-branch
	Publish.py 
Log Message:
Initial stab at allowing Zope code to return producer objects.


=== Zope/lib/python/ZPublisher/Publish.py 1.164.2.2 => 1.164.2.2.6.1 ===
--- Zope/lib/python/ZPublisher/Publish.py:1.164.2.2	Mon Nov 17 17:34:19 2003
+++ Zope/lib/python/ZPublisher/Publish.py	Sun Mar 21 14:42:25 2004
@@ -99,7 +99,11 @@
                       dont_publish_class,
                       request, bind=1)
 
-        if result is not response: response.setBody(result)
+        if result is not response:
+            if isaproducer(result):
+                response.setBodyProducer(result)
+            else:
+                response.setBody(result)
 
         if transactions_manager: transactions_manager.commit()
 
@@ -371,3 +375,6 @@
         return publish_module_standard(module_name, stdin, stdout, stderr,
                                        environ, debug, request, response)
 
+def isaproducer(data):
+    if hasattr(data, 'more'):
+        return 1




More information about the Zope-Checkins mailing list