From: Marcin Koziej Date: Fri, 14 Dec 2012 09:26:19 +0000 (+0100) Subject: fixes X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/e3f0e31b91c8a5f9232156b2deb611dc7c8b83e5?ds=sidebyside;hp=f8dfb5772407898329418480670950566f2c3281 fixes --- 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)