2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

Disable cache for report helpers (#6370) (#6371)

- Can lead to unintended consequences where REPORT_DEBUG_MODE toggles

(cherry picked from commit 25573838921c13465bcfb8afdc7e2c030c298bab)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot] 2024-01-31 15:58:45 +11:00 committed by GitHub
parent fc4e20f1b7
commit a05e07b2dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,7 @@ def asset(filename):
filename = '' + filename filename = '' + filename
# If in debug mode, return URL to the image, not a local file # If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE') debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)
# Test if the file actually exists # Test if the file actually exists
full_path = settings.MEDIA_ROOT.joinpath('report', 'assets', filename).resolve() full_path = settings.MEDIA_ROOT.joinpath('report', 'assets', filename).resolve()
@ -124,7 +124,7 @@ def uploaded_image(filename, replace_missing=True, replacement_file='blank_image
filename = '' + filename filename = '' + filename
# If in debug mode, return URL to the image, not a local file # If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE') debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)
# Check if the file exists # Check if the file exists
if not filename: if not filename:
@ -286,7 +286,7 @@ def logo_image(**kwargs):
- Otherwise, return a path to the default InvenTree logo - Otherwise, return a path to the default InvenTree logo
""" """
# If in debug mode, return URL to the image, not a local file # If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE') debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)
return InvenTree.helpers.getLogoImage(as_file=not debug_mode, **kwargs) return InvenTree.helpers.getLogoImage(as_file=not debug_mode, **kwargs)