def remove(self, hashval):
"""This function removes the file associated with the name
"hashval"."""
if self.readonly:
raise NeedToModifyReadOnlyFileManager(hashval,
"remove")
for l in self.layouts:
cur_path = l.lookup(hashval)
cur_full_path = os.path.join(self.root, cur_path)
try:
portable.remove(cur_full_path)
os.removedirs(os.path.dirname(cur_full_path))
except EnvironmentError as e:
if e.errno == errno.ENOENT or \
e.errno == errno.EEXIST:
pass
elif e.errno == errno.EACCES or \
e.errno == errno.EROFS:
raise FMPermissionsException(e.filename)
else:
raise
评论列表
文章目录