From: Armin Ronacher Date: Wed, 31 Jul 2013 20:48:52 +0000 (+0200) Subject: Fixed a CLDR import error on windows. X-Git-Tag: 2.0~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a42ac1bbae0b9dbc618e8a83b4d1315732f402f5;p=thirdparty%2Fbabel.git Fixed a CLDR import error on windows. When building the CLDR data from scratch the process would break on windows because the timezone mapping is not available yet. This fixes #43. --- diff --git a/CHANGES b/CHANGES index 8b93fd20..219f7cfe 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,8 @@ Version 1.4 converted properly by the subtag resolving. This for instance showed up when trying to use ``und_UK`` as a language code which now properly resolves to ``en_GB``. +- Fixed a bug that made it impossible to import the CLDR data + from scratch on windows systems. Version 1.3 ----------- diff --git a/babel/localtime/_win32.py b/babel/localtime/_win32.py index 1f6ecc7c..3752dffa 100644 --- a/babel/localtime/_win32.py +++ b/babel/localtime/_win32.py @@ -10,7 +10,14 @@ from babel.core import get_global import pytz -tz_names = get_global('windows_zone_mapping') +# When building the cldr data on windows this module gets imported. +# Because at that point there is no global.dat yet this call will +# fail. We want to catch it down in that case then and just assume +# the mapping was empty. +try: + tz_names = get_global('windows_zone_mapping') +except RuntimeError: + tz_names = {} def valuestodict(key):