[Zope3-checkins]
SVN: Zope3/branches/publication-refactor/src/zope/publisher/publish.py
add small change to the publish method in order to get the
Zope3 publisher
Michael Kerrin
michael.kerrin at openapp.biz
Thu Apr 20 13:04:14 EDT 2006
Log message for revision 67181:
add small change to the publish method in order to get the Zope3 publisher
to run under Zope2.
Changed:
U Zope3/branches/publication-refactor/src/zope/publisher/publish.py
-=-
Modified: Zope3/branches/publication-refactor/src/zope/publisher/publish.py
===================================================================
--- Zope3/branches/publication-refactor/src/zope/publisher/publish.py 2006-04-20 16:57:42 UTC (rev 67180)
+++ Zope3/branches/publication-refactor/src/zope/publisher/publish.py 2006-04-20 17:04:14 UTC (rev 67181)
@@ -19,6 +19,7 @@
"""
import sys
from zope.publisher.interfaces import Retry
+## from zope.publisher.interfaces import IPublisherRequest
from zope.proxy import removeAllProxies
@@ -127,7 +128,24 @@
publication.beforeTraversal(request)
obj = publication.getApplication(request)
- obj = request.traverse(obj)
+## 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):
+## obj = request.traverse(obj)
+## 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.
+## obj = IPublisherRequest(
+## request).traverse(obj)
+ try:
+ from ZPublisher.Publication import Zope3HTTPRequestTraverser
+ obj = Zope3HTTPRequestTraverser(
+ request).traverse(obj)
+ except ImportError:
+ obj = request.traverse(obj)
publication.afterTraversal(request, obj)
result = publication.callObject(request, obj)
More information about the Zope3-Checkins
mailing list