Set a default currency if it doesn't exist

main
Bob Mottram 2021-08-07 19:09:37 +01:00
parent 5ad1622bb6
commit 561e466dd9
1 changed files with 4 additions and 1 deletions

View File

@ -120,7 +120,7 @@ parser.add_argument('--libretranslateApiKey',
default=None, default=None,
help='API key for LibreTranslate service') help='API key for LibreTranslate service')
parser.add_argument('--defaultCurrency', dest='defaultCurrency', type=str, parser.add_argument('--defaultCurrency', dest='defaultCurrency', type=str,
default="EUR", default=None,
help='Default currency EUR/GBP/USD...') help='Default currency EUR/GBP/USD...')
parser.add_argument('-n', '--nickname', dest='nickname', type=str, parser.add_argument('-n', '--nickname', dest='nickname', type=str,
default=None, default=None,
@ -2699,6 +2699,9 @@ if args.registration:
setConfigParam(baseDir, 'registration', 'closed') setConfigParam(baseDir, 'registration', 'closed')
print('New registrations closed') print('New registrations closed')
defaultCurrency = getConfigParam(baseDir, 'defaultCurrency')
if not defaultCurrency:
setConfigParam(baseDir, 'defaultCurrency', 'EUR')
if args.defaultCurrency: if args.defaultCurrency:
if args.defaultCurrency == args.defaultCurrency.upper(): if args.defaultCurrency == args.defaultCurrency.upper():
setConfigParam(baseDir, 'defaultCurrency', args.defaultCurrency) setConfigParam(baseDir, 'defaultCurrency', args.defaultCurrency)