Mercurial > babel > old > babel-test
comparison babel/dates.py @ 502:0985a4562967
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:16:13 +0000 |
parents | 3f3c1696ad39 |
children | 3413235af4d8 |
comparison
equal
deleted
inserted
replaced
497:4eaad9bf0e5a | 502:0985a4562967 |
---|---|
455 | 455 |
456 locale = Locale.parse(locale) | 456 locale = Locale.parse(locale) |
457 if format in ('full', 'long', 'medium', 'short'): | 457 if format in ('full', 'long', 'medium', 'short'): |
458 format = get_date_format(format, locale=locale) | 458 format = get_date_format(format, locale=locale) |
459 pattern = parse_pattern(format) | 459 pattern = parse_pattern(format) |
460 return parse_pattern(format).apply(date, locale) | 460 return pattern.apply(date, locale) |
461 | 461 |
462 def format_datetime(datetime=None, format='medium', tzinfo=None, | 462 def format_datetime(datetime=None, format='medium', tzinfo=None, |
463 locale=LC_TIME): | 463 locale=LC_TIME): |
464 r"""Return a date formatted according to the given pattern. | 464 r"""Return a date formatted according to the given pattern. |
465 | 465 |