Commit 5d0b2745 by rfkelly0

DAVFS: expose the getpathurl() method

parent 4d291172
...@@ -145,7 +145,7 @@ class DAVFS(FS): ...@@ -145,7 +145,7 @@ class DAVFS(FS):
self._url_p = urlparse(self.url) self._url_p = urlparse(self.url)
self._cookiejar = cookielib.CookieJar() self._cookiejar = cookielib.CookieJar()
def _path2url(self,path): def getpathurl(self, path, allow_none=False):
"""Convert a client-side path into a server-side URL.""" """Convert a client-side path into a server-side URL."""
path = relpath(normpath(path)) path = relpath(normpath(path))
if path.endswith("/"): if path.endswith("/"):
...@@ -172,7 +172,7 @@ class DAVFS(FS): ...@@ -172,7 +172,7 @@ class DAVFS(FS):
This is a simple wrapper around httplib that does basic error and This is a simple wrapper around httplib that does basic error and
sanity checking e.g. following redirects and providing authentication. sanity checking e.g. following redirects and providing authentication.
""" """
url = self._path2url(path) url = self.getpathurl(path)
visited = [] visited = []
resp = None resp = None
try: try:
...@@ -577,7 +577,7 @@ class DAVFS(FS): ...@@ -577,7 +577,7 @@ class DAVFS(FS):
self._copy(src,dst,overwrite=overwrite) self._copy(src,dst,overwrite=overwrite)
def _copy(self,src,dst,overwrite=False): def _copy(self,src,dst,overwrite=False):
headers = {"Destination":self._path2url(dst)} headers = {"Destination":self.getpathurl(dst)}
if overwrite: if overwrite:
headers["Overwrite"] = "T" headers["Overwrite"] = "T"
else: else:
...@@ -604,7 +604,7 @@ class DAVFS(FS): ...@@ -604,7 +604,7 @@ class DAVFS(FS):
self._move(src,dst,overwrite=overwrite) self._move(src,dst,overwrite=overwrite)
def _move(self,src,dst,overwrite=False): def _move(self,src,dst,overwrite=False):
headers = {"Destination":self._path2url(dst)} headers = {"Destination":self.getpathurl(dst)}
if overwrite: if overwrite:
headers["Overwrite"] = "T" headers["Overwrite"] = "T"
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment