From 3c6f3da036cb8376cef931b3d4d5e354aff473d9 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 21 Nov 2011 16:24:47 +0100 Subject: [PATCH 1/1] add dry_run to fix_rdf_about --- .../management/commands/fix_rdf_about.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 -- 2.20.1