Commit db7cbe5e by willmcgugan

Fix to workaround issue sending callables over xmlrpc

parent 451b1d6c
...@@ -821,6 +821,17 @@ class FS(object): ...@@ -821,6 +821,17 @@ class FS(object):
""" """
def listdir(path, *args, **kwargs):
if ignore_errors:
try:
return self.listdir(path, *args, **kwargs)
except:
return []
else:
return self.listdir(path, *args, **kwargs)
if search == "breadth":
if wildcard is None: if wildcard is None:
wildcard = lambda f:True wildcard = lambda f:True
elif not callable(wildcard): elif not callable(wildcard):
...@@ -833,17 +844,6 @@ class FS(object): ...@@ -833,17 +844,6 @@ class FS(object):
dir_wildcard_re = re.compile(fnmatch.translate(dir_wildcard)) dir_wildcard_re = re.compile(fnmatch.translate(dir_wildcard))
dir_wildcard = lambda fn:bool (dir_wildcard_re.match(fn)) dir_wildcard = lambda fn:bool (dir_wildcard_re.match(fn))
def listdir(path, *args, **kwargs):
if ignore_errors:
try:
return self.listdir(path, *args, **kwargs)
except:
return []
else:
return self.listdir(path, *args, **kwargs)
if search == "breadth":
dirs = [path] dirs = [path]
while dirs: while dirs:
current_path = dirs.pop() current_path = dirs.pop()
...@@ -873,7 +873,7 @@ class FS(object): ...@@ -873,7 +873,7 @@ class FS(object):
except ResourceNotFoundError: except ResourceNotFoundError:
# Could happen if another thread / process deletes something whilst we are walking # Could happen if another thread / process deletes something whilst we are walking
pass pass
yield (recurse_path, self.listdir(recurse_path, wildcard=wildcard, files_only=True)) yield (recurse_path, listdir(recurse_path, wildcard=wildcard, files_only=True))
for p in recurse(path): for p in recurse(path):
yield p yield p
...@@ -1230,3 +1230,5 @@ def flags_to_mode(flags): ...@@ -1230,3 +1230,5 @@ def flags_to_mode(flags):
if flags & os.O_EXCL: if flags & os.O_EXCL:
mode += "x" mode += "x"
return mode return mode
\ No newline at end of file
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