Skip to content

Commit

Permalink
This should deal correctly with the ancestor list mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
jbradberry authored and djyasin committed Nov 11, 2024
1 parent 10a7676 commit 4eb1a55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/scripts/ig-hotfix/role_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def resolve(obj, path):
sys.stderr.write(f"Role id={r.id} has no implicit_parents\n")
if not parents <= ancestors:
sys.stderr.write(f"Role id={r.id} has parents that are not in the ancestor list: {parents - ancestors}\n")
crosslinked[r.content_type_id][r.object_id]
crosslinked[r.content_type_id][r.object_id][f'{r.role_field}_id'] = r.id
if not implicit <= parents:
sys.stderr.write(f"Role id={r.id} has implicit_parents that are not in the parents list: {implicit - parents}\n")
crosslinked[r.content_type_id][r.object_id]
crosslinked[r.content_type_id][r.object_id][f'{r.role_field}_id'] = r.id
if not implicit <= ancestors:
sys.stderr.write(f"Role id={r.id} has implicit_parents that are not in the ancestor list: {implicit - ancestors}\n")
crosslinked[r.content_type_id][r.object_id]
crosslinked[r.content_type_id][r.object_id][f'{r.role_field}_id'] = r.id

# Check that the Role's generic foreign key points to a legitimate object
if not r.content_object:
Expand Down Expand Up @@ -181,6 +181,7 @@ def resolve(obj, path):
print(" for f in role_fields:")
print(" r = getattr(obj, f.name, None)")
print(" if r is not None:")
print(" print(f'updating implicit parents on Role {r.id}')")
print(" r.implicit_parents = '[]'")
print(" r.save()")
print(" obj.save()")

0 comments on commit 4eb1a55

Please sign in to comment.