optimization when adding child groups
This commit is contained in:
parent
3629867210
commit
f1cf81b086
1 changed files with 6 additions and 3 deletions
|
@ -35,6 +35,9 @@ class Group(object):
|
||||||
|
|
||||||
if self == group:
|
if self == group:
|
||||||
raise Exception("can't add group to itself")
|
raise Exception("can't add group to itself")
|
||||||
|
|
||||||
|
# don't add if it's already there
|
||||||
|
if not group in self.child_groups:
|
||||||
self.child_groups.append(group)
|
self.child_groups.append(group)
|
||||||
group.depth = max([self.depth+1, group.depth])
|
group.depth = max([self.depth+1, group.depth])
|
||||||
group.parent_groups.append(self)
|
group.parent_groups.append(self)
|
||||||
|
|
Loading…
Reference in a new issue