From 61193bc82d695f59b3b6422e97353fb808b61e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 20 Feb 2019 11:05:10 +0100 Subject: [PATCH] misc: don't crash on missing language code (#21252) This happens with the "check" management command. --- corbo/widgets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/corbo/widgets.py b/corbo/widgets.py index 85ba234..dc541dd 100644 --- a/corbo/widgets.py +++ b/corbo/widgets.py @@ -70,7 +70,8 @@ class PickerWidgetMixin(object): attrs = {'readonly': ''} self.options = options - self.options['language'] = get_language().split('-')[0] + if get_language(): + self.options['language'] = get_language().split('-')[0] # We're not doing localisation, get the Javascript date format provided by the user, # with a default, and convert it to a Python data format for later string parsing