mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Use asset fingerprinter to serve images
This means we can cache them forever, and only invalidate the cache when the image changes.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user