From d4c2ca18397511b128b9507d932165c88159369c Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 11 Mar 2014 13:06:40 -0400 Subject: [PATCH] Add a sanity check --- .../commands/populate_filepicker.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/karmaworld/apps/notes/management/commands/populate_filepicker.py b/karmaworld/apps/notes/management/commands/populate_filepicker.py index 1c94036..b8ecc8a 100644 --- a/karmaworld/apps/notes/management/commands/populate_filepicker.py +++ b/karmaworld/apps/notes/management/commands/populate_filepicker.py @@ -27,13 +27,15 @@ class Command(BaseCommand): print "Skipping {0}".format(str(note)) continue - # grab the html from inside the note and process it - html_resp = requests.get('http:{0}{1}'.format(settings.S3_URL, note.get_relative_s3_path())) - if html_resp.status_code is not 200: - print html_resp.text - continue - - html = html_resp.text + if note.static_html: + # grab the html from inside the note and process it + html_resp = requests.get('http:{0}{1}'.format(settings.S3_URL, note.get_relative_s3_path())) + if html_resp.status_code is not 200: + print html_resp.text + continue + html = html_resp.text + else: + html = note.html fp_policy_json = '{{"expiry": {0}, "call": ["pick","store","read","stat"]}}' fp_policy_json = fp_policy_json.format(int(time.time() + 31536000)) @@ -66,6 +68,9 @@ class Command(BaseCommand): print str(note) continue + if get_resp.text != html: + print "The content at the new Filepicker URL does not match the original note contents!" + note.save() -- 2.25.1