[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container - ContainerTraversable.py:1.1.2.7 ContainerTraverser.py:1.1.2.5 IOrderedContainer.py:1.1.2.6 container.zcml:1.1.2.7
Jim Fulton
jim@zope.com
Fri, 7 Jun 2002 10:41:38 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/OFS/Container
Modified Files:
Tag: Zope-3x-branch
ContainerTraversable.py ContainerTraverser.py
IOrderedContainer.py container.zcml
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals):
- RenameAllowToRequire
- GroupClassRelatedDirectivesInClassDirective
- ViewInterfaceAndSimplification
- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes
- TwoArgumentViewConstructors
- ImplementsInZCML
- SimpleViewCreationInZCML
- RemoveGetView
- ReplaceProtectWithAllow
- ViewMethodsAsViews
- MergeProtectionAndComponentDefinitions
There were also various security fixes resulting of better integration
of security with components.
=== Zope3/lib/python/Zope/App/OFS/Container/ContainerTraversable.py 1.1.2.6 => 1.1.2.7 ===
from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
+_marker = object()
+
class ContainerTraversable:
"""Traverses containers via getattr and getObject.
@@ -44,18 +46,18 @@
def __init__(self, container):
self._container = container
+
def traverse(self, name, parameters, original_name, furtherPath):
if parameters:
raise UnexpectedParameters(parameters)
container = self._container
-
- # self is just a marker for the rest of this method.
- v = container.getObject(name, self)
- if v is self:
- v = getattr(container, name, self)
- if v is self:
+ v = container.getObject(name, _marker)
+ if v is _marker:
+ v = getattr(container, name, _marker)
+ if v is _marker:
raise NotFoundError, original_name
return v
+
=== Zope3/lib/python/Zope/App/OFS/Container/ContainerTraverser.py 1.1.2.4 => 1.1.2.5 ===
from Zope.Publisher.Exceptions import NotFound
from IContainer import IReadContainer
-from Zope.ComponentArchitecture import getRequestView
-from Zope.ComponentArchitecture import getRequestDefaultViewName
+from Zope.ComponentArchitecture import queryView
+from Zope.ComponentArchitecture import getDefaultViewName
class ContainerTraverser:
@@ -30,27 +30,27 @@
__implements__ = IBrowserPublisher, IXMLRPCPublisher
__used_for__ = IReadContainer
- def __init__(self, c):
- self._c = c
+ def __init__(self, container, request):
+ self.context = container
def publishTraverse(self, request, name):
- c = self._c
- if name.endswith(';view'):
- p = getRequestView(c, name[:-5], request)
- if p is None:
- raise NotFound(c, name, request)
- else:
- return p
+ c = self.context
+
subob = c.getObject(name, None)
if subob is None:
+
+ view = queryView(c, name, request)
+ if view is not None:
+ return view
+
raise NotFound(c, name, request)
return subob
def browserDefault(self, request):
"""
"""
- c = self._c
- view_name = getRequestDefaultViewName(c, request)
- view_uri = "%s;view" % view_name
+ c = self.context
+ view_name = getDefaultViewName(c, request)
+ view_uri = "view::%s" % view_name
return c, (view_uri,)
=== Zope3/lib/python/Zope/App/OFS/Container/IOrderedContainer.py 1.1.2.5 => 1.1.2.6 ===
"""
-
=== Zope3/lib/python/Zope/App/OFS/Container/container.zcml 1.1.2.6 => 1.1.2.7 ===
>
-<browser:view name="_traverse"
- for=".IContainer.IReadContainer"
- factory=".ContainerTraverser." />
+ <browser:view
+ name="_traverse"
+ for=".IContainer.IReadContainer"
+ factory=".ContainerTraverser." />
+
+ <xmlrpc:view
+ name="_traverse"
+ for=".IContainer.IReadContainer."
+ factory=".ContainerTraverser." />
+
+ <adapter factory=".ContainerTraversable."
+ provides="Zope.App.Traversing.ITraversable."
+ for=".IContainer.IReadContainer." />
+
+ <browser:view name="_traverse"
+ for=".IContainer."
+ factory=".ContainerTraverser." />
+
+ <xmlrpc:view name="_traverse"
+ for=".IContainer."
+ factory=".ContainerTraverser." />
+
+ <vfs:view name="_traverse"
+ for=".IContainer."
+ factory=".ContainerTraverser." />
+
+ <adapter factory=".ContainerTraversable."
+ provides="Zope.App.Traversing.ITraversable."
+ for=".IContainer.IReadContainer." />
-<xmlrpc:view name="_traverse"
- for=".IContainer.IReadContainer."
- factory=".ContainerTraverser." />
-<adapter factory=".ContainerTraversable."
- provides="Zope.App.Traversing.ITraversable."
- for=".IContainer.IReadContainer." />
-
-<security:protectClass class=".ContainerTraverser+"
- permission_id="Zope.View"
- names="publishTraverse, browserDefault" />
-
-
-<browser:view name="_traverse"
- for=".IContainer."
- factory=".ContainerTraverser." />
-
-<xmlrpc:view name="_traverse"
- for=".IContainer."
- factory=".ContainerTraverser." />
-
-<vfs:view name="_traverse"
- for=".IContainer."
- factory=".ContainerTraverser." />
-
-<adapter factory=".ContainerTraversable."
- provides="Zope.App.Traversing.ITraversable."
- for=".IContainer.IReadContainer." />
-
-
-<include package=".Find" file="find.zcml" />
+ <include package=".Find" file="find.zcml" />
</zopeConfigure>