Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

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
     
    138138 
    139139    format = "%%.%df"%num_places 
    140140    str = format%value 
     141    if num_places == 0: 
     142        return format_number(str, locale=locale) 
    141143    num, decimals = str.split(".") 
    142144    return unicode( 
    143145            format_number(num, locale) + get_decimal_format( 
  • turbogears/i18n/tests/test_format.py

     
    3737    print get_abbr_weekday_names("en_US") 
    3838 
    3939def test_format_numbers(): 
     40    assert format_decimal(5.9, 0, "de")=="6" 
     41     
    4042    assert format_number(50, "en_US")=="50" 
    4143    assert format_number(50, "de")=="50" 
    4244