[Twisted-web] Fixing a failing test
Valentino Volonghi
dialtone at gmail.com
Wed May 19 11:17:18 MDT 2004
Fixed a failing test added by mg with r296.
It was due to not detecting properly if l was already root.
Run test_url.py and all 10 tests passed.
--- url.py (revision 296)
+++ url.py (working copy)
@@ -82,6 +82,10 @@
l.append(path)
return self._pathMod(l, self.queryList(0))
+ def isRoot(self, pathlist):
+ if len(pathlist) > 2: return False
+ return True
+
def parent(self):
"""Construct a url which is a parent of this url;
This is logically equivalent to '..' of the current url.
@@ -99,7 +103,8 @@
# we are a file, such as http://example.com/foo/bar our
# parent directory is http://example.com/
l.pop()
- l[-1] = ''
+ if self.isRoot(l): l.append('')
+ else: l[-1] = ''
return self._pathMod(l, self.queryList(0))
def here(self):
More information about the Twisted-web
mailing list