From: Charles Connell Date: Tue, 11 Mar 2014 17:06:40 +0000 (-0400) Subject: Add a sanity check X-Git-Tag: release-20150131~148^2~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d4c2ca18397511b128b9507d932165c88159369c;p=oweals%2Fkarmaworld.git Add a sanity check --- 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()