Commit 85772b22 by rfkelly0

make DAVFS pass all the latest tests

parent 53e4f093
...@@ -267,6 +267,7 @@ class DAVFS(FS): ...@@ -267,6 +267,7 @@ class DAVFS(FS):
if resp.status == 409: if resp.status == 409:
raise ParentDirectoryMissingError(path) raise ParentDirectoryMissingError(path)
if resp.status not in (200,201,204): if resp.status not in (200,201,204):
print resp.status
raise_generic_error(resp,"setcontents",path) raise_generic_error(resp,"setcontents",path)
def open(self,path,mode="r"): def open(self,path,mode="r"):
...@@ -287,6 +288,8 @@ class DAVFS(FS): ...@@ -287,6 +288,8 @@ class DAVFS(FS):
elif contents.status != 200: elif contents.status != 200:
contents.close() contents.close()
raise_generic_error(resp,"open",path) raise_generic_error(resp,"open",path)
elif self.isdir(path):
raise ResourceInvalidError(path)
if mode == "r-": if mode == "r-":
contents.size = contents.getheader("Content-Length",None) contents.size = contents.getheader("Content-Length",None)
if contents.size is not None: if contents.size is not None:
...@@ -432,7 +435,6 @@ class DAVFS(FS): ...@@ -432,7 +435,6 @@ class DAVFS(FS):
entries.append((nm,info)) entries.append((nm,info))
if not dir_ok: if not dir_ok:
raise ResourceInvalidError(path) raise ResourceInvalidError(path)
return self._listdir_helper(path,entries,wildcard,full,absolute,False,False)
if wildcard is not None: if wildcard is not None:
entries = [(e,info) for (e,info) in entries if fnmatch.fnmatch(e,wildcard)] entries = [(e,info) for (e,info) in entries if fnmatch.fnmatch(e,wildcard)]
if full: if full:
......
...@@ -49,7 +49,10 @@ def normalize_req_body(body,chunk_size=1024*64): ...@@ -49,7 +49,10 @@ def normalize_req_body(body,chunk_size=1024*64):
This function is used to accept a variety of different inputs in HTTP This function is used to accept a variety of different inputs in HTTP
requests, converting them to a standard format. requests, converting them to a standard format.
""" """
if hasattr(body,"read"): if hasattr(body,"getvalue"):
value = body.getvalue()
return (len(value),[value])
elif hasattr(body,"read"):
try: try:
size = int(body.size) size = int(body.size)
except (AttributeError,TypeError): except (AttributeError,TypeError):
......
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