mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Global Cache Fix (#7393)
* Adjust situations in which cache is disabled - Prevent cache when running a number of housekeeping commands * Add 'spectacular' to list of excluded commands * Generate codes as list - Ensure consistent ordering (for CI) * Debug currency codes list * Bump API version
This commit is contained in:
parent
e83feb9414
commit
0cb762d6b2
@ -1,14 +1,16 @@
|
||||
"""InvenTree API version information."""
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 203
|
||||
INVENTREE_API_VERSION = 204
|
||||
|
||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||
|
||||
INVENTREE_API_TEXT = """
|
||||
v204 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7393
|
||||
- Fixes previous API update which resulted in inconsistent ordering of currency codes
|
||||
|
||||
v203 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7390
|
||||
- Adjust default currency codes
|
||||
- Currency codes are now configurable as a run-time setting
|
||||
|
||||
v202 - 2024-05-27 : https://github.com/inventree/InvenTree/pull/7343
|
||||
- Adjust "required" attribute of Part.category field to be optional
|
||||
|
@ -45,13 +45,9 @@ def is_global_cache_enabled():
|
||||
return False
|
||||
|
||||
# The cache should not be used during certain operations
|
||||
if any((
|
||||
InvenTree.ready.isRunningBackup(),
|
||||
InvenTree.ready.isRunningMigrations(),
|
||||
InvenTree.ready.isRebuildingData(),
|
||||
InvenTree.ready.isImportingData(),
|
||||
InvenTree.ready.isInTestMode(),
|
||||
)):
|
||||
if not InvenTree.ready.canAppAccessDatabase(
|
||||
allow_test=False, allow_plugins=False, allow_shell=True
|
||||
):
|
||||
logger.info('Global cache bypassed for this operation')
|
||||
return False
|
||||
|
||||
|
@ -114,6 +114,7 @@ def canAppAccessDatabase(
|
||||
'wait_for_db',
|
||||
'makemessages',
|
||||
'compilemessages',
|
||||
'spectactular',
|
||||
]
|
||||
|
||||
if not allow_shell:
|
||||
|
@ -68,20 +68,23 @@ def currency_codes() -> list:
|
||||
|
||||
codes = codes.split(',')
|
||||
|
||||
valid_codes = set()
|
||||
valid_codes = []
|
||||
|
||||
for code in codes:
|
||||
code = code.strip().upper()
|
||||
|
||||
if code in valid_codes:
|
||||
continue
|
||||
|
||||
if code in CURRENCIES:
|
||||
valid_codes.add(code)
|
||||
valid_codes.append(code)
|
||||
else:
|
||||
logger.warning(f"Invalid currency code: '{code}'")
|
||||
|
||||
if len(valid_codes) == 0:
|
||||
valid_codes = set(currency_codes_default_list().split(','))
|
||||
valid_codes = list(currency_codes_default_list().split(','))
|
||||
|
||||
return list(valid_codes)
|
||||
return valid_codes
|
||||
|
||||
|
||||
def currency_code_mappings() -> list:
|
||||
|
Loading…
Reference in New Issue
Block a user