Ticket #1647: format_decimal.patch
| File format_decimal.patch, 987 bytes (added by Felix.Schwarz, 4 years ago) |
|---|
-
turbogears/i18n/format.py
This patch makes format_decimal usable with num_places=0
138 138 139 139 format = "%%.%df"%num_places 140 140 str = format%value 141 if num_places == 0: 142 return format_number(str, locale=locale) 141 143 num, decimals = str.split(".") 142 144 return unicode( 143 145 format_number(num, locale) + get_decimal_format( -
turbogears/i18n/tests/test_format.py
37 37 print get_abbr_weekday_names("en_US") 38 38 39 39 def test_format_numbers(): 40 assert format_decimal(5.9, 0, "de")=="6" 41 40 42 assert format_number(50, "en_US")=="50" 41 43 assert format_number(50, "de")=="50" 42 44