[Zope3-checkins] SVN: Zope3/trunk/src/zope/i18n/locales/xmlfactory.py Updated Locale Parser to play nice with the new way of doing things.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jun 30 15:24:29 EDT 2004


Log message for revision 26007:
Updated Locale Parser to play nice with the new way of doing things.



-=-
Modified: Zope3/trunk/src/zope/i18n/locales/xmlfactory.py
===================================================================
--- Zope3/trunk/src/zope/i18n/locales/xmlfactory.py	2004-06-30 18:56:03 UTC (rev 26006)
+++ Zope3/trunk/src/zope/i18n/locales/xmlfactory.py	2004-06-30 19:24:28 UTC (rev 26007)
@@ -279,7 +279,9 @@
                 elements[type] = self._getText(element.childNodes)
             setattr(displayNames, group_tag, elements)
 
-        displayNames.types = self._extractTypes(names_nodes[0])
+        types = self._extractTypes(names_nodes[0])
+        if types is not None:
+            displayNames.types = types
         return displayNames
 
 
@@ -845,8 +847,12 @@
             return
 
         dates = LocaleDates()
-        dates.calendars = self._extractCalendars(dates_nodes[0])
-        dates.timezones = self._extractTimeZones(dates_nodes[0])
+        calendars = self._extractCalendars(dates_nodes[0])
+        if calendars is not None:
+            dates.calendars = calendars
+        timezones = self._extractTimeZones(dates_nodes[0])
+        if timezones is not None:
+            dates.timezones = timezones
         return dates
 
 
@@ -1074,9 +1080,13 @@
             return
 
         numbers = LocaleNumbers()
-        numbers.symbols = self._extractSymbols(numbers_nodes[0])
+        symbols = self._extractSymbols(numbers_nodes[0])
+        if symbols is not None: 
+            numbers.symbols = symbols
         self._extractNumberFormats(numbers_nodes[0], numbers)
-        numbers.currencies = self._extractCurrencies(numbers_nodes[0])
+        currencies = self._extractCurrencies(numbers_nodes[0])
+        if currencies is not None:
+            numbers.currencies = currencies
         return numbers
     
 
@@ -1129,10 +1139,22 @@
     def __call__(self):
         """Create the Locale."""
         locale = Locale(self._extractIdentity())
-        locale.displayNames = self._extractDisplayNames()
-        locale.dates = self._extractDates()
-        locale.numbers = self._extractNumbers()
-        locale.delimiters = self._extractDelimiters
+
+        names = self._extractDisplayNames()
+        if names is not None:
+            locale.displayNames = names 
+
+        dates = self._extractDates()
+        if dates is not None:
+            locale.dates = dates
+
+        numbers = self._extractNumbers()
+        if numbers is not None:
+            locale.numbers = numbers
+
+        delimiters = self._extractDelimiters()
+        if delimiters is not None:
+            locale.delimiters = delimiters
         
         # Unmapped:
         #



More information about the Zope3-Checkins mailing list