fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Edit <opis>"
[redakcja.git]
/
scripts
/
fix_something.py
diff --git
a/scripts/fix_something.py
b/scripts/fix_something.py
index
5978130
..
2d73ba1
100755
(executable)
--- 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:
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:
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:
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")
fc.commit(newtxt, author=author, description=u"Automatyczna zmiana atrybutu name na nazwa")
+ else:
+ print "%s ==> i would change this" % book.slug
import sys
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:
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)
for b in Book.objects.all():
fix(b, me, dry_run)