summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-28 11:57:17 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-28 11:57:17 +0000
commit812371007f53fdda6b428a4e9349df1b69fcd235 (patch)
tree6f42de2196af78e57cb42055972bc4bd9f35b9f7
parent70cc2047b8bb358a8418c11ec0d39d09120ffd3c (diff)
downloadpyramid-812371007f53fdda6b428a4e9349df1b69fcd235.tar.gz
pyramid-812371007f53fdda6b428a4e9349df1b69fcd235.tar.bz2
pyramid-812371007f53fdda6b428a4e9349df1b69fcd235.zip
Use lstrip and rstrip; traverser now has no "locatable".
-rw-r--r--repoze/bfg/tests/test_traversal.py10
-rw-r--r--repoze/bfg/traversal.py6
2 files changed, 2 insertions, 14 deletions
diff --git a/repoze/bfg/tests/test_traversal.py b/repoze/bfg/tests/test_traversal.py
index 3b0c4318c..4782ab264 100644
--- a/repoze/bfg/tests/test_traversal.py
+++ b/repoze/bfg/tests/test_traversal.py
@@ -225,16 +225,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
environ = self._getEnviron(PATH_INFO='/%s' % segment)
self.assertRaises(TypeError, policy, environ)
- def test_locatable_bwcompat(self):
- root = DummyContext()
- from repoze.bfg.interfaces import ILocation
- from zope.interface import directlyProvides
- policy = self._makeOne(root)
- self.assertEqual(policy.locatable, False)
- directlyProvides(root, ILocation)
- self.assertEqual(policy.locatable, True)
-
-
class FindInterfaceTests(unittest.TestCase):
def _callFUT(self, context, iface):
from repoze.bfg.traversal import find_interface
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py
index 4c9f5dfb2..f43935ff4 100644
--- a/repoze/bfg/traversal.py
+++ b/repoze/bfg/traversal.py
@@ -194,10 +194,8 @@ def traversal_path(path):
(u'archives', u'<unprintable unicode>')
"""
- while path.startswith('/'):
- path = path[1:]
- while path.endswith('/'):
- path = path[:-1]
+ path = path.rstrip('/')
+ path = path.lstrip('/')
clean = []
for segment in path.split('/'):
segment = urllib.unquote(segment) # deal with spaces in path segment