I'm trying to work out how to use WSGI with Zope, as I believe that this is the way to attach a filter to Zope output. However the seem to be some issues with Zope 2.10.3. Setting use-wsgi on in zope.conf seems to break Five. The interfaces tab is no longer visible in the ZMI and Plone stops working (giving me an AttributeError: @@plone). This seems tricky to debug though as ZPublisher.test still works.

Changing ZPublisher.Test.publish_method to use WSGIPublisher.publish rather than Publish.publish brings up the zope 3 security issues when running the Five tests as bug #2190, but these can be fixed with the same interaction fix that Philipp applied to Publish.py in r71819 (see attached diff). Having applied this fix I still get the same problems with AttributeError: @@plone and the manage_interfaces tab not showing up.

If anyone has an example of attaching a filter to Zope output using WSGI you'd make my day.

Laurence
Index: Test.py
===================================================================
--- Test.py     (revision 75846)
+++ Test.py     (working copy)
@@ -92,6 +92,7 @@
 
 $Id$
 '''
+#' Waaaa 2
 __version__='$Revision: 1.41 $'[11:-2]
 
 DONE_STRING_DEFAULT = '\n%s\n\n' % ('_'*60)
@@ -180,7 +181,7 @@
     after_list=[None]
     from Response import Response
     from Request import Request
-    from Publish import publish
+    from WSGIPublisher import publish
     try:
         try:
             if response is None:
Index: WSGIPublisher.py
===================================================================
--- WSGIPublisher.py    (revision 75846)
+++ WSGIPublisher.py    (working copy)
@@ -23,6 +23,7 @@
 from zExceptions import Redirect
 from cStringIO import StringIO
 from ZServer.medusa.http_date import build_http_date
+from zope.security.management import newInteraction, endInteraction
 
 class WSGIResponse(Response):
     """A response object for WSGI
@@ -164,6 +165,9 @@
     parents=None
     response=None
     try:
+        # TODO pass request here once BaseRequest implements IParticipation
+        newInteraction()
+        
         request.processInputs()
 
         request_get=request.get
@@ -209,6 +213,7 @@
 
         if transactions_manager:
             transactions_manager.commit()
+        endInteraction()
 
         return response
     except:
@@ -245,6 +250,7 @@
             finally:
                 if transactions_manager:
                     transactions_manager.abort()
+                endInteraction()
 
             # Only reachable if Retry is raised and request supports retry.
             newrequest=request.retry()
@@ -257,6 +263,7 @@
         else:
             if transactions_manager:
                 transactions_manager.abort()
+            endInteraction()
             raise
 
 def publish_module_standard(environ, start_response):
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to