def del_file(self, location, file, dir=None, timeout=None):
"""Must be used with 'yield' as
'loc = yield scheduler.del_file(location, "file1")'.
Delete 'file' from peer at 'location'. 'dir' must be same as that used
for 'send_file'.
"""
if isinstance(dir, basestring) and dir:
dir = dir.strip()
# reject absolute path for dir
if os.path.join(os.sep, dir) == dir:
raise StopIteration(-1)
kwargs = {'file': os.path.basename(file), 'dir': dir}
req = _NetRequest('del_file', kwargs=kwargs, dst=location, timeout=timeout)
reply = yield _Peer._sync_reply(req)
if reply is None:
reply = -1
raise StopIteration(reply)
评论列表
文章目录