diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-08-09 10:14:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-09 10:14:32 +0200 |
| commit | f1262ffa9e20a951eb001192d151beca39bc62fe (patch) | |
| tree | 8e25258bb0ff138a90b412ada65843007567f493 /searx/utils.py | |
| parent | 49403dbbda96d3c943a7c8d71979effebf53e447 (diff) | |
| parent | ad58b14be7cc9a1e95858e150e9d8005734d9232 (diff) | |
Merge pull request #588 from a01200356/wikidata
[enh] More data from Wikidata
Diffstat (limited to 'searx/utils.py')
| -rw-r--r-- | searx/utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/searx/utils.py b/searx/utils.py index c027bff20..aa8ce92a1 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -206,7 +206,13 @@ def format_date_by_locale(date, locale_string): if locale_string == 'all': locale_string = settings['ui']['default_locale'] or 'en_US' - return format_date(date, locale=locale_string) + # to avoid crashing if locale is not supported by babel + try: + formatted_date = format_date(date, locale=locale_string) + except: + formatted_date = format_date(date, "YYYY-MM-dd") + + return formatted_date def dict_subset(d, properties): |