let Node.delete evict the node in question

This commit is contained in:
Thomas Nagy 2012-05-06 10:43:56 +02:00
parent 34bd6ce7eb
commit d931b656f8
1 changed files with 2 additions and 6 deletions

View File

@ -188,7 +188,7 @@ class Node(object):
os.chmod(self.abspath(), val)
def delete(self):
"""Delete the file/folder physically (but not the node)"""
"""Delete the file/folders, and remove this node from the tree. It becomes invalid after that"""
try:
if getattr(self, 'children', None):
shutil.rmtree(self.abspath())
@ -196,11 +196,7 @@ class Node(object):
os.unlink(self.abspath())
except OSError:
pass
try:
delattr(self, 'children')
except AttributeError:
pass
self.evict()
def evict(self):
"""Internal - called when a node is removed"""