[Zope3-checkins] SVN: Zope3/branches/publication-refactor2/src/zope/publisher/publish.py Add in my temporary fix to the publish.py file in order to

Michael Kerrin michael.kerrin at openapp.biz
Thu Apr 20 13:30:09 EDT 2006


Log message for revision 67183:
  Add in my temporary fix to the publish.py file in order to
  get the publish method to work under Zope2 conditions.
  

Changed:
  U   Zope3/branches/publication-refactor2/src/zope/publisher/publish.py

-=-
Modified: Zope3/branches/publication-refactor2/src/zope/publisher/publish.py
===================================================================
--- Zope3/branches/publication-refactor2/src/zope/publisher/publish.py	2006-04-20 17:09:34 UTC (rev 67182)
+++ Zope3/branches/publication-refactor2/src/zope/publisher/publish.py	2006-04-20 17:30:09 UTC (rev 67183)
@@ -132,6 +132,25 @@
                             publication.beforeTraversal(request)
 
                             object = publication.getApplication(request)
+## XXX - we should use adapters and interfaces here but Five says
+## that the Zope2 request object implements IPublisherRequest when
+## the API for the traverse method is different on the Zope2 request.
+##                             if IPublisherRequest.providedBy(request):
+##                                 object = request.traverse(object)
+##                             else:
+##                                 # The Zope2 request traverse method corresponds
+##                                 # to a different API, so adapt the request
+##                                 # object to a IPublisherRequest object and
+##                                 # then call the traverse method.
+##                                 object = IPublisherRequest(
+##                                     request).traverse(object)
+                            try:
+                                from ZPublisher.Publication import \
+                                     Zope3HTTPRequestTraverser
+                                object = Zope3HTTPRequestTraverser(
+                                    request).traverse(object)
+                            except ImportError:
+                                object = request.traverse(object)
                             object = request.traverse(object)
                             publication.afterTraversal(request, object)
 



More information about the Zope3-Checkins mailing list