[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Traversing - __init__.py:1.12
Steve Alexander
steve@cat-box.net
Thu, 5 Dec 2002 09:29:22 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing
In directory cvs.zope.org:/tmp/cvs-serv12957/lib/python/Zope/App/Traversing
Modified Files:
__init__.py
Log Message:
getting Parent and Parents depends on them being wrapped, so we should
insist on having a context wrapped object here.
=== Zope3/lib/python/Zope/App/Traversing/__init__.py 1.11 => 1.12 ===
--- Zope3/lib/python/Zope/App/Traversing/__init__.py:1.11 Thu Dec 5 08:45:59 2002
+++ Zope3/lib/python/Zope/App/Traversing/__init__.py Thu Dec 5 09:29:22 2002
@@ -43,9 +43,6 @@
code unexpectedly.
Consider using traverseName instead.
"""
- # XXX This made no sense. It would mean you couldn't traverse from root
- #if not _isWrapper(place):
- # raise TypeError, "Not enough context information to traverse"
traverser = _Traverser(place)
if default is _marker:
return traverser.traverse(path, request=request)
@@ -88,6 +85,8 @@
Raises TypeError if the given object is not context wrapped
"""
+ if not _isWrapper(obj):
+ raise TypeError, "Not enough context information to traverse"
iterator = _WrapperChain(obj)
iterator.next() # send head of chain (current object) to /dev/null
return [p for p in iterator]
@@ -123,7 +122,7 @@
Raises a ValueError if a poorly formed location is given.
"""
if not location:
- raise ValueError, "location must be non-empty."
+ raise ValueError, "location must be non-empty: %s" % repr(location)
if isinstance(location, tuple):
t = tuple(map(unicode, location))
elif isinstance(location, StringTypes):