[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - PublicationTraverse.py:1.1.2.14
Gary Poster
garyposter@earthlink.net
Mon, 15 Apr 2002 00:00:57 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv27012
Modified Files:
Tag: Zope-3x-branch
PublicationTraverse.py
Log Message:
fixes acquire namespace--or at least makes it accomplish what I understand it to mean!
=== Zope3/lib/python/Zope/App/ZopePublication/PublicationTraverse.py 1.1.2.13 => 1.1.2.14 ===
from Zope.Publisher.Exceptions import NotFound
from types import StringTypes
-from Zope.ContextWrapper import Wrapper
+from Zope.ContextWrapper import Wrapper, getcontext
from Zope.App.ZMI.Addable import ContentAddables
from Zope.App.OFS.Container.IContainer import IWriteContainer
@@ -150,16 +150,35 @@
return ApplicationController
def _traverseacquire(self, request, ob, name):
+ """acquires content objects from higher in tree"""
i = 0
+ origOb=ob
while i < 200:
i = i + 1
- r = getattr(ob, name, self)
- if r is not self:
- return r
- r = getcontext(ob)
- if r is None:
- raise NotFound(ob, name, request)
- raise ExcessiveWrapping(ob, name, request)
+ #r = getattr(ob, name, self) # no...
+ # what we actually want to do is traverse ob, then parents, yes?
+ # this is a cut and paste of the pertinent traverseName code;
+ # clean to your pleasure, if desired.
+ try:
+ if request.getViewType().isImplementedBy(ob):
+ ob2 = ob.publishTraverse(request, name)
+ else:
+ adapter = getRequestView(ob, '_traverse', request, self # marker
+ )
+
+ if adapter is not self:
+ ob2 = adapter.publishTraverse(request, name)
+ else:
+ raise NotFound(ob, name, request)
+ # the only difference--is this the best way to
+ # accomplish the wrap we want?
+ return self._wrap(ob2, origOb, name, name)
+
+ except NotFound:
+ ob = getcontext(ob)
+ if ob is None:
+ raise NotFound(origOb, name, request)
+ raise ExcessiveWrapping(origOb, name, request)
def _traversecreate(self, request, ob, name):
for addable in ContentAddables.getAddables(ob):