Skip to content

Commit 61370cc

Browse files
author
Mike Taylor
committed
Issue #3401 - Unbreak bust_cache
1 parent e6890e3 commit 61370cc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/unit/test_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def test_bust_cache_production_missing_file():
147147
def test_bust_cache_production_file_exists(tmpdir):
148148
"""Test cache_bust with the right checksum."""
149149
webcompat.app.config['LOCALHOST'] = None
150-
webcompat.templates.STATIC_PATH = tmpdir
150+
webcompat.templates.STATIC_PATH = ''
151151
file_path = tmpdir.join('space.js')
152152
file_path.write_text('punkcat', encoding='utf-8')
153153
expected = 'space.js' + '?501753e94c8bfbbbd53c792c9688c8b5'
154-
assert bust_cache('space.js') == expected
154+
assert expected in bust_cache(str(file_path))

webcompat/templates/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def bust_cache(file_path):
3030
"""
3131
if app.config['LOCALHOST']:
3232
return file_path
33-
absolute_path = os.path.join(STATIC_PATH, file_path)
34-
return file_path + '?' + get_checksum(absolute_path)
33+
return file_path + '?' + get_checksum(STATIC_PATH + file_path)
3534

3635

3736
def get_checksum(file_path):
@@ -41,6 +40,7 @@ def get_checksum(file_path):
4140
except KeyError:
4241
checksum = md5_checksum(file_path)
4342
cache_dict[str(file_path)] = checksum
43+
print('GET_CHECKSUM (after cache miss)', cache_dict)
4444
return checksum
4545

4646

0 commit comments

Comments
 (0)