]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fixed a CLDR import error on windows.
authorArmin Ronacher <armin.ronacher@active-4.com>
Wed, 31 Jul 2013 20:48:52 +0000 (22:48 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 31 Jul 2013 20:48:52 +0000 (22:48 +0200)
When building the CLDR data from scratch the process would break on
windows because the timezone mapping is not available yet.

This fixes #43.

CHANGES
babel/localtime/_win32.py

diff --git a/CHANGES b/CHANGES
index 8b93fd200b0d24ecda3d105f5b8f307ea4360021..219f7cfe9cf433ca4b7eab0dfb0f0f32d04fb569 100644 (file)
--- 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
 -----------
index 1f6ecc7c0da80b610b5b9fba48fe10a45f2efff5..3752dffac8898555ad2f860e3bc3b178c3927b69 100644 (file)
@@ -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):