From: Radek Czajka Date: Mon, 21 Nov 2011 15:24:47 +0000 (+0100) Subject: add dry_run to fix_rdf_about X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/3c6f3da036cb8376cef931b3d4d5e354aff473d9?hp=d04035572b5a730f522a471b583bd2de10578024 add dry_run to fix_rdf_about --- diff --git a/apps/catalogue/management/commands/fix_rdf_about.py b/apps/catalogue/management/commands/fix_rdf_about.py index 8ff68c3d..c252c208 100755 --- a/apps/catalogue/management/commands/fix_rdf_about.py +++ b/apps/catalogue/management/commands/fix_rdf_about.py @@ -22,6 +22,7 @@ class Command(BaseCommand): from lxml import etree verbose = options.get('verbose') + dry_run = options.get('dry_run') # Start transaction management. transaction.commit_unless_managed() @@ -64,13 +65,14 @@ class Command(BaseCommand): print "already correct" continue desc.set(attr_name, correct_about) - new_head = chunk.commit(etree.tostring(t, encoding=unicode), - author_name='platforma redakcyjna', - description='auto-update rdf:about' - ) - # retain the publishable status - if old_head.publishable: - new_head.set_publishable(True) + if not dry_run: + new_head = chunk.commit(etree.tostring(t, encoding=unicode), + author_name='platforma redakcyjna', + description='auto-update rdf:about' + ) + # retain the publishable status + if old_head.publishable: + new_head.set_publishable(True) if verbose: print "done" done += 1