X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/877f24b0b26f4f2473f8d6dfe2946a213bd286c0..2cb75203ca8c818977153f6b9b72030333d232e3:/scripts/fix_something.py diff --git a/scripts/fix_something.py b/scripts/fix_something.py index 59781308..2d73ba16 100755 --- a/scripts/fix_something.py +++ b/scripts/fix_something.py @@ -22,19 +22,21 @@ tag_with_name = r"<([^>]+)name=\"([^>]+)>" def fix(book, author, dry_run=True): if len(book) == 0: - print "%s does not contain chunks" % book.slug + print "%s ==> does not contain chunks" % book.slug return fc = book[0] txt = fc.materialize() newtxt, cnt = re.subn(tag_with_name, r'<\1nazwa="\2>', txt) if cnt == 0: - print "%s nothing changed" % book + print "%s ==> nothing changed" % book.slug return if not dry_run: - print "%s changing" % book + print "%s ==> changing" % book.slug fc.commit(newtxt, author=author, description=u"Automatyczna zmiana atrybutu name na nazwa") + else: + print "%s ==> i would change this" % book.slug import sys @@ -46,7 +48,7 @@ opts, oth_ = getopt.getopt(sys.argv[1:], dry_run = not (("--seriously",'') in opts) me = User.objects.get(username='marcinkoziej') if dry_run: - print "This is a dry run, to really change dates, run with --seriously" + print "This is a dry run, to really fix something, run with --seriously" for b in Book.objects.all(): fix(b, me, dry_run)