Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: twisted/twisted
base: trunk
...
head fork: twisted/twisted
compare: urlpath-quote-2625
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 28, 2009
exarkun Branching to 'urlpath-quote-2625'
git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/urlpath-quote-2625@27252 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
a003a2e
exarkun Apply 2625.2.patch
refs #2625


git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/urlpath-quote-2625@27253 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
02f7179
exarkun Clean up some docstring language; fix some minor coding standard viol…
…ations

refs #2625


git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/urlpath-quote-2625@27254 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
d488b4c
Showing with 36 additions and 7 deletions.
  1. +25 −6 twisted/python/urlpath.py
  2. +11 −1 twisted/test/test_paths.py
31 twisted/python/urlpath.py
View
@@ -54,20 +54,39 @@ def _pathMod(self, newpathsegs, keepQuery):
'/'.join(newpathsegs),
query)
- def sibling(self, path, keepQuery=0):
+
+ def sibling(self, path, keepQuery=False):
l = self.pathList()
l[-1] = path
return self._pathMod(l, keepQuery)
- def child(self, path, keepQuery=0):
+
+ def child(self, path, keepQuery=False):
+ """
+ Add a child segment to URL path part.
+
+ @param path: The I{unquoted} path segment to add.
+ @type path: C{str}
+
+ @param keepQuery: If set to True, keep the current query part in the
+ result, otherwise discard it.
+ @type keepQuery: C{bool}
+
+ @return: A new L{URLPath} object with the same values as this one,
+ but with C{path} added as a new segment to the path.
+ @rtype: L{URLPath}
+ """
+ # Store the quoted version
+ fixedPath = urllib.quote(path, '')
l = self.pathList()
if l[-1] == '':
- l[-1] = path
+ l[-1] = fixedPath