Mercurial > public > sg101
diff core/management/commands/ssl_images.py @ 889:ae146e30d588
Ensure the cache is populated correctly.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 10 Feb 2015 20:36:34 -0600 |
parents | deef1536a54a |
children | 101728976f9c |
line wrap: on
line diff
--- a/core/management/commands/ssl_images.py Mon Feb 09 20:25:13 2015 -0600 +++ b/core/management/commands/ssl_images.py Tue Feb 10 20:36:34 2015 -0600 @@ -171,10 +171,14 @@ # Check to see if the image is available via https first. new_url = check_https_availability(parsed_url) if new_url: + url_cache[src] = new_url return new_url # If none of the above worked, try to download and upload to our S3 bucket - return save_image_to_cloud(src) + new_url = save_image_to_cloud(src) + if new_url: + url_cache[src] = new_url + return new_url def check_https_availability(parsed_url): @@ -215,10 +219,7 @@ fn = download_image(src) if fn: resize_image(fn) - new_url = upload_image(fn) - if new_url: - url_cache[src] = new_url - return new_url + return upload_image(fn) return None @@ -355,7 +356,7 @@ warn_if_image_refs(txt, model_name, model.pk) new_txt = process_post(txt) if txt != new_txt: - logger.info("Content changed on %s #%d (pk= %d)", + logger.info("Content changed on %s #%d (pk = %d)", model_name, n + i, model.pk) logger.debug("original: %s", txt) logger.debug("changed: %s", new_txt)