Created
May 15, 2012 13:24
-
-
Save ashleyconnor/2701731 to your computer and use it in GitHub Desktop.
flask-babel error using Khmer locale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from flaskext.babel import refresh; refresh() | |
>>> khmer = format_datetime(datetime(1987, 10, 10, 18, 00), 'full') | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/flaskext/babel.py", line 317, in format_datetime | |
return _date_format(dates.format_datetime, datetime, format, rebase) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/flaskext/babel.py", line 382, in _date_format | |
return formatter(obj, format, locale=locale, **extra) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 505, in format_datetime | |
locale=locale)) \ | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 590, in format_time | |
return parse_pattern(format).apply(time, locale) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 702, in apply | |
return self % DateTimeFormat(datetime, locale) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 699, in __mod__ | |
return self.format % other | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 760, in __getitem__ | |
return self.format_timezone(char, num) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 850, in format_timezone | |
locale=self.locale) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 421, in get_timezone_name | |
return get_timezone_location(dt_or_tzinfo, locale=locale) | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/dates.py", line 278, in get_timezone_location | |
territory_name = locale.territories[territory] | |
File "/Users/ashleyconnor/.virtualenvs/flask/lib/python2.7/site-packages/babel/localedata.py", line 195, in __getitem__ | |
orig = val = dict.__getitem__(self, key) | |
KeyError: 'ZZ' | |
>>> khmer = format_datetime(datetime(1987, 10, 10, 18, 00)) | |
>>> print(khmer.encode('utf8')) | |
10 ១០ 1987, 18:00:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment