[Zope3-checkins] CVS: Zope3/src/zope/i18n - locales.py:1.13

Stephan Richter srichter@cbu.edu
Thu, 10 Apr 2003 02:17:01 -0400


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv25493/src/zope/i18n

Modified Files:
	locales.py 
Log Message:
Fixed formatter lookup. There is still a lot todo. I will have to take 
some serious time to write tests for the lookup. Maybe sathya can help?


=== Zope3/src/zope/i18n/locales.py 1.12 => 1.13 ===
--- Zope3/src/zope/i18n/locales.py:1.12	Tue Mar 25 14:00:35 2003
+++ Zope3/src/zope/i18n/locales.py	Thu Apr 10 02:17:00 2003
@@ -410,6 +410,8 @@
             pattern = self.getDefaultCalendar().timePatterns[name]
         except (AttributeError, KeyError):
             return self._getNextLocale().getTimeFormatter(name)
+        if not pattern:
+            return self._getNextLocale().getTimeFormatter(name)
         return DateTimeFormat(pattern, self._createFullCalendar())
 
     def getDateFormatter(self, name):
@@ -418,6 +420,8 @@
             pattern = self.getDefaultCalendar().datePatterns[name]
         except (AttributeError, KeyError):
             return self._getNextLocale().getDateFormatter(name)
+        if not pattern:
+            return self._getNextLocale().getDateFormatter(name)
         return DateTimeFormat(pattern, self._createFullCalendar())
 
     def getDateTimeFormatter(self, name):
@@ -426,6 +430,8 @@
             pattern = self.getDefaultCalendar().datetimePattern
         except (AttributeError, KeyError):
             return self._getNextLocale().getDateTimeFormatter(name)
+        if not pattern:
+            return self._getNextLocale().getDateTimeFormatter(name)
         date_pat = self.getDateFormatter(name).getPattern()
         time_pat = self.getTimeFormatter(name).getPattern()
         pattern = pattern.replace('{1}', date_pat)
@@ -437,6 +443,8 @@
         try:
             pattern = self.getDefaultNumberFormat().patterns[name]
         except (AttributeError, KeyError):
+            return self._getNextLocale().getNumberFormatter(name)
+        if not pattern:
             return self._getNextLocale().getNumberFormatter(name)
         symbols = {}
         for id in ((None, None, None),