Commit 09b34494 by rfkelly0

OSFS.watch_inotify: add convert_os_errors wrapper

parent 1c48944a
...@@ -251,7 +251,7 @@ class DAVFS(FS): ...@@ -251,7 +251,7 @@ class DAVFS(FS):
if self.closed: if self.closed:
raise RemoteConnectionError("",msg="FS is closed") raise RemoteConnectionError("",msg="FS is closed")
resp = con.getresponse() resp = con.getresponse()
#logger.debug("DAVFS <RESP %s %s/%s",method,url.hostname,url.path) #logger.debug("DAVFS <RESP %s %s %s/%s",resp.status,method,url.hostname,url.path)
self._cookiejar.extract_cookies(FakeResp(resp),FakeReq(con,url.scheme,url.path)) self._cookiejar.extract_cookies(FakeResp(resp),FakeReq(con,url.scheme,url.path))
except Exception, e: except Exception, e:
self._del_connection(con) self._del_connection(con)
......
...@@ -48,6 +48,7 @@ class OSFSWatchMixin(WatchableFSMixin): ...@@ -48,6 +48,7 @@ class OSFSWatchMixin(WatchableFSMixin):
finally: finally:
self.__watch_lock.release() self.__watch_lock.release()
@convert_os_errors
def add_watcher(self,callback,path="/",events=None,recursive=True): def add_watcher(self,callback,path="/",events=None,recursive=True):
super_add_watcher = super(OSFSWatchMixin,self).add_watcher super_add_watcher = super(OSFSWatchMixin,self).add_watcher
w = super_add_watcher(callback,path,events,recursive) w = super_add_watcher(callback,path,events,recursive)
...@@ -79,6 +80,7 @@ class OSFSWatchMixin(WatchableFSMixin): ...@@ -79,6 +80,7 @@ class OSFSWatchMixin(WatchableFSMixin):
self.__watch_lock.release() self.__watch_lock.release()
return w return w
@convert_os_errors
def del_watcher(self,watcher_or_callback): def del_watcher(self,watcher_or_callback):
if isinstance(watcher_or_callback,Watcher): if isinstance(watcher_or_callback,Watcher):
watchers = [watcher_or_callback] watchers = [watcher_or_callback]
......
...@@ -10,7 +10,7 @@ simulate such an ability on top of an ordinary FS object. ...@@ -10,7 +10,7 @@ simulate such an ability on top of an ordinary FS object.
An FS object that wants to be "watchable" must provide the following methods: An FS object that wants to be "watchable" must provide the following methods:
* add_watcher(path,callback,events=None,recursive=True) * add_watcher(callback,path="/",events=None,recursive=True)
Request that the given callback be executed in response to changes Request that the given callback be executed in response to changes
to the given path. A specific set of change events can be specified. to the given path. A specific set of change events can be specified.
......
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