[Sugar-devel] [PATCH] Workaround to Python 2.7 regression in locale.format(): it disallows trailing text after the format specifier.
Walter Bender
walter.bender at gmail.com
Fri Nov 26 10:40:02 EST 2010
On Fri, Nov 26, 2010 at 10:06 AM, Simon Schampijer <simon at schampijer.de> wrote:
> Thanks Walter for this patch.
>
> By reading here: http://www.gossamer-threads.com/lists/python/bugs/875810
> and https://bugs.launchpad.net/update-manager/+bug/673297 you should just
> use locale.format_string(). This is as well backwards compatible (works in
> 2.6).
>
> With this change, good by me.
---
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/extensions/cpsection/updater/view.py
+++ b/extensions/cpsection/updater/view.py
@@ -385,7 +385,7 @@ def _format_size(size):
return _('1 KB')
elif size < 1024 * 1024:
# TRANS: download size of small updates, e.g. '250 KB'
- return locale.format(_('%.0f KB'), size / 1024.0)
+ return locale.format_string(_('%.0f KB'), size / 1024.0)
else:
# TRANS: download size of updates, e.g. '2.3 MB'
- return locale.format(_('%.1f MB'), size / 1024.0 / 1024)
+ return locale.format_string(_('%.1f MB'), size / 1024.0 / 1024)
--
1.7.3.2
>
> Regards,
> Simon
>
> Acked-by: Simon Schampijer <simon at schampijer.de>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
--
Walter Bender
Sugar Labs
http://www.sugarlabs.org
More information about the Sugar-devel
mailing list