From: Kevin Deldycke Date: Thu, 3 Mar 2016 17:17:44 +0000 (+0100) Subject: Only attempt a normalization search if filesystem lookup fails. X-Git-Tag: 2.3.1~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F361%2Fhead;p=thirdparty%2Fbabel.git Only attempt a normalization search if filesystem lookup fails. --- diff --git a/babel/localedata.py b/babel/localedata.py index 265e4b8f..1f437379 100644 --- a/babel/localedata.py +++ b/babel/localedata.py @@ -44,7 +44,10 @@ def exists(name): :param name: the locale identifier string """ - return True if normalize_locale(name) else False + if name in _cache: + return True + file_found = os.path.exists(os.path.join(_dirname, '%s.dat' % name)) + return True if file_found else bool(normalize_locale(name)) def locale_identifiers():