[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.1.2.4 acquirenamespace.py:1.1.2.3 attritemnamespaces.py:1.1.2.2 defaulttraversable.py:1.1.2.2 etcnamespace.py:1.1.2.2 exceptions.py:1.1.2.2 getresource.py:1.1.2.3 modulenamespace.py:1.1.2.2 namespaces.py:1.1.2.3 objectname.py:1.1.2.3 parameterparsing.py:1.1.2.2 physicallocationadapters.py:1.1.2.4 presentationnamespaces.py:1.1.2.3 skinnamespace.py:1.1.2.2 traverser.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:24 -0500
Update of /cvs-repository/Zope3/src/zope/app/traversing
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/traversing
Modified Files:
Tag: NameGeddon-branch
__init__.py acquirenamespace.py attritemnamespaces.py
defaulttraversable.py etcnamespace.py exceptions.py
getresource.py modulenamespace.py namespaces.py objectname.py
parameterparsing.py physicallocationadapters.py
presentationnamespaces.py skinnamespace.py traverser.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/traversing/__init__.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.1.2.3 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/__init__.py Tue Dec 24 21:20:52 2002
@@ -1,14 +1,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
Traversing the object tree.
@@ -30,16 +30,16 @@
# in the arguments of the call to traverser.traverse
def traverse(place, path, default=_marker, request=None):
"""Traverse 'path' relative to 'place'
-
+
'path' can be a string with path segments separated by '/'
or a sequence of path segments.
-
+
Raises NotFoundError if path cannot be found
Raises TypeError if place is not context wrapped
-
+
Note: calling traverse with a path argument taken from an untrusted
source, such as an HTTP request form variable, is a bad idea.
- It could allow a maliciously constructed request to call
+ It could allow a maliciously constructed request to call
code unexpectedly.
Consider using traverseName instead.
"""
@@ -55,10 +55,10 @@
# traverse one step.
def traverseName(obj, name, default=_marker):
"""Traverse a single step 'name' relative to 'place'
-
+
'name' must be a string. 'name' will be treated as a single
path segment, no matter what characters it contains.
-
+
Raises NotFoundError if path cannot be found
Raises TypeError if place is not context wrapped
"""
@@ -69,24 +69,24 @@
def objectName(obj):
"""Get the name an object was traversed via
-
+
Raises TypeError if the object is not context-wrapped
"""
return _getAdapter(obj, _IObjectName)()
-
+
def getParent(obj):
"""Returns the container the object was traversed via.
-
+
Raises TypeError if the given object is not context wrapped
"""
if not _isWrapper(obj):
raise TypeError, "Not enough context information to traverse"
return _getWrapperContext(obj)
-
+
def getParents(obj):
"""Returns a list starting with the given object's parent followed by
each of its parents.
-
+
Raises TypeError if the given object is not context wrapped
"""
if not _isWrapper(obj):
@@ -94,26 +94,26 @@
iterator = _WrapperChain(obj)
iterator.next() # send head of chain (current object) to /dev/null
return [p for p in iterator]
-
+
def getPhysicalPath(obj):
"""Returns a tuple of names representing the physical path to the object.
-
+
Raises TypeError if the given object is not context wrapped
"""
return _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath()
def getPhysicalPathString(obj):
"""Returns a string representing the physical path to the object.
-
+
Raises TypeError if the given object is not context wrapped
"""
path = _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath()
return locationAsUnicode(path)
-
-
+
+
def getPhysicalRoot(obj):
"""Returns the root of the traversal for the given object.
-
+
Raises TypeError if the given object is not context wrapped
"""
return _getAdapter(obj, _IPhysicallyLocatable).getPhysicalRoot()
@@ -122,7 +122,7 @@
"""Given a location as a unicode or ascii string or as a tuple of
unicode or ascii strings, returns the location as a tuple of
unicode strings.
-
+
Raises a ValueError if a poorly formed location is given.
"""
if not location:
@@ -137,19 +137,19 @@
else:
raise ValueError, \
"location %s must be a string or a tuple of strings." % (location,)
-
+
if len(t) > 1 and t[-1] == u'': # matches '' or u''
raise ValueError, \
"location tuple %s must not end with empty string." % (t,)
# don't usually need this, so just an assertion rather than a value error
assert '' not in t[1:]
return t
-
+
def locationAsUnicode(location):
"""Given a location as a unicode or ascii string or as a tuple of
unicode or ascii strings, returns the location as a slash-separated
unicode string.
-
+
Raises ValueError if a poorly formed location is given.
"""
if not location:
=== Zope3/src/zope/app/traversing/acquirenamespace.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/acquirenamespace.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/acquirenamespace.py Tue Dec 24 21:20:52 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -52,4 +52,3 @@
raise NotFoundError(origOb, pname)
raise ExcessiveWrapping(origOb, pname)
-
=== Zope3/src/zope/app/traversing/attritemnamespaces.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/attritemnamespaces.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/attritemnamespaces.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
=== Zope3/src/zope/app/traversing/defaulttraversable.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/defaulttraversable.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/defaulttraversable.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
from zope.app.interfaces.traversing.traversable import ITraversable
from zope.exceptions import NotFoundError
@@ -31,10 +31,9 @@
r = getattr(subject, name, _marker)
if r is not _marker:
return r
-
+
if hasattr(subject, '__getitem__'):
# Let exceptions propagate.
return self._subject[name]
else:
raise NotFoundError(self._subject, name)
-
=== Zope3/src/zope/app/traversing/etcnamespace.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/etcnamespace.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/etcnamespace.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -43,12 +43,12 @@
return applicationController
if name != 'Services':
-
+
raise NotFoundError(ob, pname, request)
method_name = "getServiceManager"
method = getattr(ob, method_name, None)
- if method is None:
+ if method is None:
raise NotFoundError(ob, pname, request)
return method()
=== Zope3/src/zope/app/traversing/exceptions.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/exceptions.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/exceptions.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
=== Zope3/src/zope/app/traversing/getresource.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/getresource.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/getresource.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -32,5 +32,3 @@
if resource is None:
return default
return ContextWrapper(resource, resource_service, name=name)
-
-
=== Zope3/src/zope/app/traversing/modulenamespace.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/modulenamespace.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/modulenamespace.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -23,7 +23,7 @@
def module(name, parameters, pname, ob, request):
- """Used to traverse to a module (in dot notation)"""
+ """Used to traverse to a module (in dot notation)"""
servicemanager = getServiceManager(ob)
adapter = getAdapter(servicemanager, INameResolver)
if adapter is not None:
=== Zope3/src/zope/app/traversing/namespaces.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/namespaces.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/namespaces.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -43,13 +43,13 @@
The resulting object is returned in the context of the original.
This means that the caller should *not* wrap the result.
"""
-
+
handler = _namespace_handlers.get(ns)
if handler is None:
raise NotFoundError(name)
new = handler(qname, parameters, name, object, request)
- if new is object:
+ if new is object:
# The handler had a side effect only and didn't look up a
# different object. We want to retain the side-effect name
# for things like URLs.
@@ -60,12 +60,12 @@
# because the inner wrapper will be the original object, so
# our added layer with the name we want to preserve will be
# ignored when searching containment.
-
+
# For this reason, we'll remove a layer of wrapping from new
# before we put it in context.
new = getWrapperObject(new)
-
+
new = ContextWrapper(new, object, name='.', side_effect_name=name)
else:
=== Zope3/src/zope/app/traversing/objectname.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/objectname.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/objectname.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""
@@ -29,7 +29,7 @@
def __repr__():
"""Get a string representation
"""
-
+
def __call__():
"""Get a string representation
"""
@@ -37,7 +37,7 @@
class ObjectName(object):
__implements__ = IObjectName
-
+
def __init__(self, context):
self.context = context
@@ -55,10 +55,10 @@
class SiteObjectName(object):
__implements__ = IObjectName
-
+
def __init__(self, context):
pass
-
+
def __str__(self):
return ''
=== Zope3/src/zope/app/traversing/parameterparsing.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/parameterparsing.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/parameterparsing.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""
@@ -23,13 +23,13 @@
def parameterizedNameParse(name):
"""Parse a name with parameters, including namespace parameters.
-
+
Return:
-
+
- namespace, or None if there isn't one.
-
+
- unparameterized name.
-
+
- sequence of parameters, as name-value pairs.
"""
=== Zope3/src/zope/app/traversing/physicallocationadapters.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/traversing/physicallocationadapters.py:1.1.2.3 Tue Dec 24 07:51:22 2002
+++ Zope3/src/zope/app/traversing/physicallocationadapters.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""XXX short summary goes here.
@@ -55,7 +55,7 @@
return container_path
return container_path + (name, )
-
+
class RootPhysicallyLocatable:
__doc__ = IPhysicallyLocatable.__doc__
@@ -74,6 +74,3 @@
def getPhysicalRoot(self):
"See IPhysicallyLocatable"
return self.context
-
-
-
=== Zope3/src/zope/app/traversing/presentationnamespaces.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/presentationnamespaces.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/presentationnamespaces.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -45,4 +45,3 @@
raise NotFoundError(ob, pname)
return resource
-
=== Zope3/src/zope/app/traversing/skinnamespace.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/traversing/skinnamespace.py:1.1.2.1 Mon Dec 23 14:32:33 2002
+++ Zope3/src/zope/app/traversing/skinnamespace.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
=== Zope3/src/zope/app/traversing/traverser.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/traversing/traverser.py:1.1.2.2 Mon Dec 23 18:52:36 2002
+++ Zope3/src/zope/app/traversing/traverser.py Tue Dec 24 21:20:53 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Default implementation of ITraverser.
@@ -49,7 +49,7 @@
def __init__(self, wrapper):
self.context = wrapper
-
+
def traverse(self, path, default=_marker, request=None):
if not path:
return self.context
@@ -107,5 +107,3 @@
if default == _marker:
raise
return default
-
-