Merge branch 'Develop'
# Conflicts: # MANIFEST.in # README.md # cps/helper.py # cps/static/js/archive/archive.js # cps/translations/nl/LC_MESSAGES/messages.mo # cps/translations/nl/LC_MESSAGES/messages.po # cps/ub.py # cps/updater.py # cps/web.py # cps/worker.py # optional-requirements.txt
This commit is contained in:
+9
-3
@@ -17,8 +17,14 @@
|
||||
# Inspired by https://github.com/ChrisTM/Flask-CacheBust
|
||||
# Uses query strings so CSS font files are found without having to resort to absolute URLs
|
||||
|
||||
import hashlib
|
||||
from __future__ import division, print_function, unicode_literals
|
||||
import os
|
||||
import hashlib
|
||||
|
||||
from . import logger
|
||||
|
||||
|
||||
log = logger.create()
|
||||
|
||||
|
||||
def init_cache_busting(app):
|
||||
@@ -34,7 +40,7 @@ def init_cache_busting(app):
|
||||
|
||||
hash_table = {} # map of file hashes
|
||||
|
||||
app.logger.debug('Computing cache-busting values...')
|
||||
log.debug('Computing cache-busting values...')
|
||||
# compute file hashes
|
||||
for dirpath, __, filenames in os.walk(static_folder):
|
||||
for filename in filenames:
|
||||
@@ -47,7 +53,7 @@ def init_cache_busting(app):
|
||||
file_path = rooted_filename.replace(static_folder, "")
|
||||
file_path = file_path.replace("\\", "/") # Convert Windows path to web path
|
||||
hash_table[file_path] = file_hash
|
||||
app.logger.debug('Finished computing cache-busting values')
|
||||
log.debug('Finished computing cache-busting values')
|
||||
|
||||
def bust_filename(filename):
|
||||
return hash_table.get(filename, "")
|
||||
|
||||
Reference in New Issue
Block a user