From 643dca0071e52d6aaca5a87384beedb29fb6e92b Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 29 Nov 2018 14:28:29 +0000
Subject: [PATCH] Use asset fingerprinter to serve images
This means we can cache them forever, and only invalidate the cache
when the image changes.
---
app/asset_fingerprinter.py | 5 ++---
.../service-settings/branding/email-options.html | 2 +-
app/templates/views/signedout.html | 10 +++++-----
app/templates/views/using-notify.html | 2 +-
tests/app/main/test_asset_fingerprinter.py | 12 ++++++------
5 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/app/asset_fingerprinter.py b/app/asset_fingerprinter.py
index e712a5ebe..228b9d512 100644
--- a/app/asset_fingerprinter.py
+++ b/app/asset_fingerprinter.py
@@ -1,4 +1,3 @@
-import codecs
import hashlib
@@ -37,11 +36,11 @@ class AssetFingerprinter(object):
def get_asset_fingerprint(self, asset_file_path):
return hashlib.md5(
- self.get_asset_file_contents(asset_file_path).encode('utf-8')
+ self.get_asset_file_contents(asset_file_path)
).hexdigest()
def get_asset_file_contents(self, asset_file_path):
- with codecs.open(asset_file_path, encoding='utf-8') as asset_file:
+ with open(asset_file_path, 'rb') as asset_file:
contents = asset_file.read()
return contents
diff --git a/app/templates/views/service-settings/branding/email-options.html b/app/templates/views/service-settings/branding/email-options.html
index 28771e7ba..d91073164 100644
--- a/app/templates/views/service-settings/branding/email-options.html
+++ b/app/templates/views/service-settings/branding/email-options.html
@@ -26,7 +26,7 @@
{% for option in form.options %}
{{ radio(option) }}
diff --git a/app/templates/views/signedout.html b/app/templates/views/signedout.html
index d45aaaabe..79c23f081 100644
--- a/app/templates/views/signedout.html
+++ b/app/templates/views/signedout.html
@@ -54,7 +54,7 @@
-

+
@@ -71,7 +71,7 @@
@@ -88,7 +88,7 @@
phone numbers and Notify sends the messages.
@@ -98,7 +98,7 @@
back office system.
@@ -180,7 +180,7 @@
diff --git a/app/templates/views/using-notify.html b/app/templates/views/using-notify.html
index a0874223e..ceefd2e16 100644
--- a/app/templates/views/using-notify.html
+++ b/app/templates/views/using-notify.html
@@ -37,7 +37,7 @@
Sending messages
When you send a message, it moves through different states in Notify.
