[Zope-Checkins] SVN: Zope/branches/publication-refactor/lib/python/
Using a new ITraversalRequest adapter to adapt the Zope2
requests.traversal method to
Lennart Regebro
regebro at gmail.com
Fri Apr 21 05:51:55 EDT 2006
Log message for revision 67200:
Using a new ITraversalRequest adapter to adapt the Zope2 requests.traversal method to
the Zope3 version.
Changed:
U Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml
U Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py
U Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py
-=-
Modified: Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml
===================================================================
--- Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 09:38:13 UTC (rev 67199)
+++ Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 09:51:55 UTC (rev 67200)
@@ -50,5 +50,14 @@
<five:implements class="ZPublisher.HTTPRequest.HTTPRequest"
interface="zope.publisher.interfaces.browser.IBrowserRequest"
/>
+
+ <five:implements class="ZPublisher.HTTPRequest.HTTPRequest"
+ interface=".interfaces.IZope2Request"
+ />
+ <adapter
+ for=".interfaces.IZope2Request"
+ factory="ZPublisher.Publication.Zope3HTTPRequestTraverser"
+ provides="zope.publisher.interfaces.ITraversingRequest"
+ />
</configure>
Modified: Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py
===================================================================
--- Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py 2006-04-21 09:38:13 UTC (rev 67199)
+++ Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py 2006-04-21 09:51:55 UTC (rev 67200)
@@ -27,6 +27,10 @@
find the method to be published.
"""
+class IZope2Request(Interface):
+ """Marks the Zope2 request"""
+ pass
+
class IMenuItemType(IInterface):
"""Menu item type
Modified: Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py
===================================================================
--- Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 09:38:13 UTC (rev 67199)
+++ Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 09:51:55 UTC (rev 67200)
@@ -49,7 +49,7 @@
_marker = object()
class Zope3HTTPRequestTraverser(object):
- implements(IPublisherRequest)
+ implements(zope.publisher.interfaces.ITraversingRequest)
def __init__(self, request):
self.request = request
@@ -61,12 +61,7 @@
return self.request.traverse(path, self.request.response,
self.request.publication.validated_hook)
-## XXX - Five declares that HTTPRequest implements IPublisherRequest
-## but in fact it doesn't, the traverse method API is all wrong.
-## component.provideAdapter(Zope3HTTPRequestTraverser, (HTTPRequest,),
-## IPublisherRequest)
-
class ZopePublication(object):
"""Base Zope2 publication specification.
"""
@@ -229,7 +224,8 @@
sys.exc_info()[2],
)
except:
- return request.response.exception()
+ request.response.exception()
+ return request.response
finally:
self._abort()
More information about the Zope-Checkins
mailing list