no log: added some failsafe to language conversion process for erroneous db content (ie.: why do I have a path in language field?!? old stuff...).

pull/1439/head v0.9.6-beta.25
morpheus65535 3 years ago
parent de4ff35e05
commit bd0a2fe004

@ -367,14 +367,19 @@ class Languages(Resource):
code2 = language code2 = language
elif len(language) == 3: elif len(language) == 3:
code2 = alpha2_from_alpha3(language) code2 = alpha2_from_alpha3(language)
else:
continue
if not any(x['code2'] == code2 for x in languages_dicts): if not any(x['code2'] == code2 for x in languages_dicts):
languages_dicts.append({ try:
'code2': code2, languages_dicts.append({
'name': language_from_alpha2(code2), 'code2': code2,
# Compatibility: Use false temporarily 'name': language_from_alpha2(code2),
'enabled': False # Compatibility: Use false temporarily
}) 'enabled': False
})
except:
continue
return jsonify(sorted(languages_dicts, key=itemgetter('name'))) return jsonify(sorted(languages_dicts, key=itemgetter('name')))
result = TableSettingsLanguages.select(TableSettingsLanguages.name, result = TableSettingsLanguages.select(TableSettingsLanguages.name,

Loading…
Cancel
Save