Mercurial > babel > old > babel-test
comparison babel/dates.py @ 503:3295127550fe stable-0.9.x
Merged revisions 554 via svnmerge from
http://svn.edgewall.org/repos/babel/trunk
........
r554 | jruigrok | 2011-02-22 16:16:13 +0100 (di, 22 feb 2011) | 4 lines
Small speed improvement for format_date() by getting rid of duplicate parse_pattern.
Issue: #216
Submitted by: St?phane D?murget
........
author | jruigrok |
---|---|
date | Tue, 22 Feb 2011 15:39:46 +0000 |
parents | 5fb3585d2a6e |
children | f2098e9c05b4 |
comparison
equal
deleted
inserted
replaced
501:03809d2f8552 | 503:3295127550fe |
---|---|
454 | 454 |
455 locale = Locale.parse(locale) | 455 locale = Locale.parse(locale) |
456 if format in ('full', 'long', 'medium', 'short'): | 456 if format in ('full', 'long', 'medium', 'short'): |
457 format = get_date_format(format, locale=locale) | 457 format = get_date_format(format, locale=locale) |
458 pattern = parse_pattern(format) | 458 pattern = parse_pattern(format) |
459 return parse_pattern(format).apply(date, locale) | 459 return pattern.apply(date, locale) |
460 | 460 |
461 def format_datetime(datetime=None, format='medium', tzinfo=None, | 461 def format_datetime(datetime=None, format='medium', tzinfo=None, |
462 locale=LC_TIME): | 462 locale=LC_TIME): |
463 """Return a date formatted according to the given pattern. | 463 """Return a date formatted according to the given pattern. |
464 | 464 |