X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1a6cd382132f5fceb9894b34ea923539b67c80bc..527c5dba85fcdfd70755b6c1f899dbb21f5ec40a:/apps/catalogue/management/commands/checkintegrity.py diff --git a/apps/catalogue/management/commands/checkintegrity.py b/apps/catalogue/management/commands/checkintegrity.py index 0892a7815..6ae2b9a2f 100644 --- a/apps/catalogue/management/commands/checkintegrity.py +++ b/apps/catalogue/management/commands/checkintegrity.py @@ -42,20 +42,20 @@ class Command(BaseCommand): print "To resolve: republish parent book." print - # Check for parent l-tags. + # Check for ancestry. parents = [] parent = book.parent while parent: parents.append(parent) parent = parent.parent - ltags = [b.book_tag() for b in parents] - if set(ltags) != set(book.tags.filter(category='book')): + ancestors = list(book.ancestor.all()) + if set(ancestors) != set(parents): if options['verbose']: - print "Wrong book tags for book:", book - print "Is: ", ", ".join(sorted(t.slug for t in book.tags.filter(category='book'))) - print "Should be:", ", ".join(sorted(t.slug for t in ltags)) + print "Wrong ancestry for book:", book + print "Is: ", ", ".join(ancestors) + print "Should be:", ", ".join(parents) if not options['dry_run']: - book.tags = ltags + list(book.tags.exclude(category='book')) + book.repopulate_ancestors() if options['verbose']: print "Fixed." if options['verbose']: