-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
In https://bugs.launchpad.net/zope.i18n/+bug/1073940, Murithi reported:
The versions of LDML files in locales/data are pretty old (released in 2004). Getting any new version from unicode.org: http://unicode.org/repos/cldr/trunk/common/main/ reveals a number of issues:
- Parsing the generation in this format:
<generation date="$Date: 2012-10-11 23:11:48 +0300 (Thu, 11 Oct 2012) $"/>fails:
File ".../eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/locales/xmlfactory.py", line 79, in _extractVersion
generationDate = date(int(year), int(month), int(day))
ValueError: invalid literal for int() with base 10: '$Date: 2012'
- There is an assumption that a date format e.g.:
<dateFormat>
<pattern>MMMM d, y</pattern>
</dateFormat>implies length for all the date parts - it does not and will fail when formatting dates.
File ".../eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/format.py", line 192, in format
text += info.get(elem, elem)
TypeError: coercing to Unicode: need string or buffer, tuple found
<type 'exceptions.TypeError'>:
coercing to Unicode: need string or buffer, tuple found
> /home/undesa/bungeni_apps/bungeni/eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/format.py(192)format()
-> text += info.get(elem, elem)This likely never bombed before since a lookup of the info dictionary always returned a string.
getFormatter (zope/i18n/locales/__init__.py LINE 495)
There are a number of issues with lookup here:
formats = getattr(cal, category+'Formats')
if length is None:
length = getattr(
cal,
'default'+category[0].upper()+category[1:]+'Format',
formats.keys()[0])
# 'datetime' is always a bit special; we often do not have a length
# specification, but we need it for looking up the date and time
# formatters
if category == 'dateTime':
formatLength = formats.get(length, formats[None])For instance:
length = getattr(cal, 'default'+category[0].upper()+category[1:]+'Format', formats.keys()[0])Why should this fall back to looking up the format key from the calendar instance?
Also,formats[None]raises an AttributeError
Reactions are currently unavailable