diff options
author | Steve Alexander <steve@z3u.com> | 2002-12-05 13:45:59 +0000 |
---|---|---|
committer | Steve Alexander <steve@z3u.com> | 2002-12-05 13:45:59 +0000 |
commit | 10fccbf04dbe0d92c23309dc65d6262623cc53f4 (patch) | |
tree | a07671fdf42a7abe2f6d08fa1b695de66b4f9590 | |
parent | 255493c43051e27cf692a6c89189b4391fa141c7 (diff) | |
download | zope-traversing-10fccbf04dbe0d92c23309dc65d6262623cc53f4.tar.gz |
Removed the requirement that objects are always context wrapped for
discovering their physical paths. This doesn't apply for the root object,
for example, and might also not apply for objects that supply a different
PhysicallyLocatable adapter that doesn't depend on context wrappers.
-rw-r--r-- | __init__.py | 8 | ||||
-rw-r--r-- | tests/testConvenienceFunctions.py | 26 |
2 files changed, 1 insertions, 33 deletions
diff --git a/__init__.py b/__init__.py index 530b43f..046bf9a 100644 --- a/__init__.py +++ b/__init__.py @@ -88,8 +88,6 @@ def getParents(obj): 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] @@ -99,9 +97,6 @@ def getPhysicalPath(obj): Raises TypeError if the given object is not context wrapped """ - if not _isWrapper(obj): - raise TypeError, "Not enough context information to traverse" - return _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath() def getPhysicalPathString(obj): @@ -109,9 +104,6 @@ def getPhysicalPathString(obj): Raises TypeError if the given object is not context wrapped """ - if not _isWrapper(obj): - raise TypeError, "Not enough context information to traverse" - path = _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath() return locationAsUnicode(path) diff --git a/tests/testConvenienceFunctions.py b/tests/testConvenienceFunctions.py index 30520e8..5798b08 100644 --- a/tests/testConvenienceFunctions.py +++ b/tests/testConvenienceFunctions.py @@ -13,7 +13,7 @@ ############################################################################## """ -$Id: testConvenienceFunctions.py,v 1.8 2002/11/26 19:00:21 stevea Exp $ +$Id: testConvenienceFunctions.py,v 1.9 2002/12/05 13:45:59 stevea Exp $ """ from unittest import TestCase, TestSuite, main, makeSuite from Zope.App.OFS.Services.ServiceManager.tests.PlacefulSetup \ @@ -151,14 +151,6 @@ class Test(PlacefulSetup, TestCase): [self.folder, self.root] ) - def testGetParentsFromUnwrapped(self): - from Zope.App.Traversing import getParents - self.assertRaises( - TypeError, - getParents, - self.unwrapped_item - ) - def testGetPhysicalPath(self): from Zope.App.Traversing import getPhysicalPath self.assertEqual( @@ -187,14 +179,6 @@ class Test(PlacefulSetup, TestCase): u'/', ) - def testGetPhysicalPathFromUnwrapped(self): - from Zope.App.Traversing import getPhysicalPath - self.assertRaises( - TypeError, - getPhysicalPath, - self.unwrapped_item - ) - def testGetPhysicalRoot(self): from Zope.App.Traversing import getPhysicalRoot self.assertEqual( @@ -202,14 +186,6 @@ class Test(PlacefulSetup, TestCase): self.root ) - def testGetPhysicalRootFromUnwrapped(self): - from Zope.App.Traversing import getPhysicalRoot - self.assertRaises( - TypeError, - getPhysicalRoot, - self.unwrapped_item - ) - _bad_locations = ( (UnicodeError, ('',u'123','\xa323')), (UnicodeError, '\xa323'), |