Ticket #2491: 0001-Workaround-to-Python-2.7-regression-in-locale.format.patch

File 0001-Workaround-to-Python-2.7-regression-in-locale.format.patch, 1.1 KB (added by walter, 9 years ago)

using format_string()

  • extensions/cpsection/updater/view.py

    From c0885c5fe55dca2d9fb4df32b7a4e9bae95a301b Mon Sep 17 00:00:00 2001
    From: Walter Bender <walter@sugarlabs.org>
    Date: Fri, 26 Nov 2010 10:35:56 -0500
    Subject: [PATCH] Workaround to Python 2.7 regression in locale.format(): it disallows trailing text after the format specifier.
    
    ---
     extensions/cpsection/updater/view.py |    4 ++--
     1 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
    index de50d8d..814658f 100644
    a b def _format_size(size): 
    385385        return _('1 KB')
    386386    elif size < 1024 * 1024:
    387387        # TRANS: download size of small updates, e.g. '250 KB'
    388         return locale.format(_('%.0f KB'), size / 1024.0)
     388        return locale.format_string(_('%.0f KB'), size / 1024.0)
    389389    else:
    390390        # TRANS: download size of updates, e.g. '2.3 MB'
    391         return locale.format(_('%.1f MB'), size / 1024.0 / 1024)
     391        return locale.format_string(_('%.1f MB'), size / 1024.0 / 1024)