7915: Prevent user creating a cycle in the place hierarchy

This commit is contained in:
Nick Hall 2014-07-15 19:37:04 +01:00
parent 8de7d287b7
commit 8ffa78ad19

View File

@ -74,9 +74,10 @@ class EditPlaceRef(EditSecondary):
skip = [handle] skip = [handle]
while todo: while todo:
handle = todo.pop() handle = todo.pop()
for child in self.dbstate.db.find_place_child_handles(handle): for child in self.db.find_backlink_handles(handle, ['Place']):
todo.append(child) if child[1] not in skip:
skip.append(child) todo.append(child[1])
skip.append(child[1])
return skip return skip
def select_parent(self, button): def select_parent(self, button):