[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - Traversers.py:1.1.2.4 ZopePublication.py:1.1.2.9
Shane Hathaway
shane@digicool.com
Tue, 20 Nov 2001 14:37:34 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv23524/lib/python/Zope/App/ZopePublication
Modified Files:
Tag: Zope-3x-branch
Traversers.py ZopePublication.py
Log Message:
- Stitched together container presentation.
- Changed signature of browser_default and NotFound.
=== Zope3/lib/python/Zope/App/ZopePublication/Traversers.py 1.1.2.3 => 1.1.2.4 ===
+#
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
@@ -19,9 +21,12 @@
def browser_default(self, request):
ob = self.target
- if hasattr(ob, 'index_html'):
- ob.index_html, ('index_html',)
- return self.target, None
+ # Use the default presentation.
+ p = getPresentation(ob, '', IBrowserPublisher)
+ if p is None:
+ raise PresentationNotFound
+ r = p.browser_default(request)
+ return r
def browser_traverse(self, request, name):
""" """
@@ -38,7 +43,7 @@
subob = ob[name]
except (KeyError, IndexError,
TypeError, AttributeError):
- raise NotFound(ob, name, request.getURL())
+ raise NotFound(ob, name, request)
if not getattr(subob, '__doc__', None):
raise DebugError(subob, 'Missing or empty doc string at: %s' %
request.getURL())
=== Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py 1.1.2.8 => 1.1.2.9 ===
from Zope.Publisher.mapply import mapply
from Zope.Publisher.Exceptions import Retry
+from types import StringType
class RequestContainer:
@@ -85,9 +86,7 @@
)
def getDefaultTraversal(self, request, ob):
- raise NotImplemented(
- 'This method must be overridden.'
- )
+ return ob, None
def afterTraversal(self, request, ob):
#recordMetaData(object, request)
@@ -142,14 +141,16 @@
if adapter is not None:
return adapter.browser_traverse(request, name)
- raise NotFound(ob, name, request.getURL())
+ raise NotFound(ob, name, request)
def getDefaultTraversal(self, request, ob):
+ r = (ob, None)
+
if IBrowserPublisher.isImplementedBy(ob):
- return ob.browser_default(request)
-
- adapter = getPresentation(ob, '_traverse', IBrowserPublisher, None)
- if adapter is not None:
- return adapter.browser_default(request)
+ r = ob.browser_default(request)
+ else:
+ adapter = getPresentation(ob, '_traverse', IBrowserPublisher, None)
+ if adapter is not None:
+ r = adapter.browser_default(request)
+ return r
- return ob, None