mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Catch exception (#5008)
* Catch exception * Update settings.py Don't print out exception message, just log error * Update settings.py Style fixes * Update settings.py Remove error message * Update settings.py Remove logger
This commit is contained in:
parent
2f98ed7022
commit
8ca02cb105
@ -7,14 +7,13 @@ from moneyed import CURRENCIES
|
||||
|
||||
def currency_code_default():
|
||||
"""Returns the default currency code (or USD if not specified)"""
|
||||
from django.db.utils import ProgrammingError
|
||||
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
try:
|
||||
code = InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY', create=False, cache=False)
|
||||
except ProgrammingError: # pragma: no cover
|
||||
# database is not initialized yet
|
||||
except Exception: # pragma: no cover
|
||||
# Database may not yet be ready, no need to throw an error here
|
||||
code = ''
|
||||
|
||||
if code not in CURRENCIES:
|
||||
@ -42,4 +41,4 @@ def stock_expiry_enabled():
|
||||
"""Returns True if the stock expiry feature is enabled."""
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY')
|
||||
return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY', False, create=False)
|
||||
|
Loading…
Reference in New Issue
Block a user