[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Traversing - AcquireNamespace.py:1.1.2.2 AttrItemNamespaces.py:1.1.2.2 Namespaces.py:1.1.2.2 ParameterParsing.py:1.1.2.2 PresentationNamespaces.py:1.1.2.2 Traverser.py:1.1.2.12 traversing.zcml:1.1.2.2
Jim Fulton
jim@zope.com
Fri, 7 Jun 2002 10:41:49 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/Traversing
Modified Files:
Tag: Zope-3x-branch
AcquireNamespace.py AttrItemNamespaces.py Namespaces.py
ParameterParsing.py PresentationNamespaces.py Traverser.py
traversing.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/Traversing/AcquireNamespace.py 1.1.2.1 => 1.1.2.2 ===
from Exceptions import UnexpectedParameters
from Zope.Exceptions import NotFoundError
-from Zope.ComponentArchitecture import getAdapter
+from Zope.ComponentArchitecture import queryAdapter
from Zope.Proxy.ContextWrapper import ContextWrapper, getWrapperContext
from ITraversable import ITraversable
@@ -34,7 +34,7 @@
origOb = ob
while i < 200:
i += 1
- traversable = getAdapter(ob, ITraversable, None)
+ traversable = queryAdapter(ob, ITraversable, None)
if traversable is not None:
try:
=== Zope3/lib/python/Zope/App/Traversing/AttrItemNamespaces.py 1.1.2.1 => 1.1.2.2 ===
"""
-from Zope.ComponentArchitecture import getRequestView, getRequestResource
from Namespaces import provideNamespaceHandler
from Exceptions import UnexpectedParameters
=== Zope3/lib/python/Zope/App/Traversing/Namespaces.py 1.1.2.1 => 1.1.2.2 ===
# Register the etc, view, and resource namespaces
import EtcNamespace, PresentationNamespaces, AttrItemNamespaces
+import CreateNamespace, AcquireNamespace
=== Zope3/lib/python/Zope/App/Traversing/ParameterParsing.py 1.1.2.1 => 1.1.2.2 ===
"""
-class DuplicateNamespaces(Exception):
- """More than one namespace was specified in a request"""
-
def parameterizedNameParse(name):
"""Parse a name with parameters, including namespace parameters.
@@ -31,7 +28,18 @@
- sequence of parameters, as name-value pairs.
"""
- ns = ''
+
+ l = name.find('::')
+ if l > 0:
+ ns = name[:l]
+ name = name[l+2:]
+ else:
+ ns = ''
+
+ if ';' not in name:
+ return ns, name, ()
+
+
parts = name.split(';')
nm = parts[:1][0]
parms = ()
@@ -40,15 +48,10 @@
if l >= 0:
pname = param[:l]
pval = param[l+1:]
- if pname == 'ns':
- if ns:
- raise DuplicateNamespaces(name)
- ns = pval
- else:
- parms += ((pname, pval),)
else:
- if ns:
- raise DuplicateNamespaces(name)
- ns = param
+ pname = param
+ pval = ''
+ parms += ((pname, pval),)
+
return ns, nm, parms
=== Zope3/lib/python/Zope/App/Traversing/PresentationNamespaces.py 1.1.2.1 => 1.1.2.2 ===
"""
-from Zope.ComponentArchitecture import getRequestView, getRequestResource
+from Zope.ComponentArchitecture import getView, getResource
from Namespaces import provideNamespaceHandler
from Exceptions import UnexpectedParameters
from Zope.Exceptions import NotFoundError
@@ -30,7 +30,7 @@
raise UnexpectedParameters(parameters)
if not request:
raise NoRequest(pname)
- return getRequestView(ob, name, request)
+ return getView(ob, name, request)
provideNamespaceHandler('view', view)
@@ -39,7 +39,7 @@
raise UnexpectedParameters(parameters)
if not request:
raise NoRequest(pname)
- return getRequestResource(ob, name, request)
+ return getResource(ob, name, request)
provideNamespaceHandler('resource', resource)
=== Zope3/lib/python/Zope/App/Traversing/Traverser.py 1.1.2.11 => 1.1.2.12 ===
from Zope.Proxy.ContextWrapper import getWrapperContext, getWrapperData
from Zope.Proxy.ContextWrapper import ContextWrapper
-from Zope.ComponentArchitecture import getAdapter
+from Zope.ComponentArchitecture import queryAdapter
from Zope.Exceptions import NotFoundError, Unauthorized
from Namespaces import namespaceLookup
from ParameterParsing import parameterizedNameParse
@@ -97,7 +97,7 @@
continue
- if name.find(';') >= 0:
+ if ':' in name or ';' in name:
ns, nm, parms = parameterizedNameParse(name)
if ns:
curr = namespaceLookup(name, ns, nm, parms,
@@ -107,7 +107,7 @@
parms = ()
nm = name
- traversable = getAdapter(curr, ITraversable, None)
+ traversable = queryAdapter(curr, ITraversable, None)
if traversable is None:
raise NotFoundError, 'No traversable adapter found'
=== Zope3/lib/python/Zope/App/Traversing/traversing.zcml 1.1.2.1 => 1.1.2.2 ===
<adapter factory="Zope.App.Traversing.DefaultTraversable."
- provides="Zope.App.Traversing.ITraversable." />
+ provides="Zope.App.Traversing.ITraversable." />
</zopeConfigure>