Merge pull request #361 from cchurch/recursive_inventory

Fix inventory issues when a group is its own parent
This commit is contained in:
Matthew Jones
2015-08-06 21:30:45 -04:00
3 changed files with 28 additions and 1 deletions

View File

@@ -222,6 +222,9 @@ class Inventory(CommonModel):
def update_group_depths(group_pk, current_depth=0):
max_depth = group_depths.get(group_pk, -1)
# Arbitrarily limit depth to avoid hitting Python recursion limit (which defaults to 1000).
if current_depth > 100:
return
if current_depth > max_depth:
group_depths[group_pk] = current_depth
for child_pk in group_children_map.get(group_pk, set()):