From a528e6f4af0aaa128b657550e4ae6d87c6a1aa87 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 22 Mar 2013 15:24:41 +0100 Subject: [PATCH] fix number formatting function --- util/format.py | 6 ++---- util/format.txt | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/util/format.py b/util/format.py index 388117a..7a7f780 100644 --- a/util/format.py +++ b/util/format.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 Helmut Merz helmutm@cy55.de +# Copyright (c) 2013 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Some simple standard formatting routines. - -$Id$ """ from zope.i18n.locales import locales @@ -54,7 +52,7 @@ def formatDate(dt=None, type='date', variant='medium', lang='de'): def formatNumber(num, type='decimal', lang='de'): loc = locales.getLocale(lang) - fmt = de.numbers.getFormatter(type) + fmt = loc.numbers.getFormatter(type) return fmt.format(num) diff --git a/util/format.txt b/util/format.txt index 3bb7fb2..32c0f9b 100644 --- a/util/format.txt +++ b/util/format.txt @@ -2,8 +2,6 @@ Basic Formatting Functions ========================== -$Id$ - >>> from cybertools.util import format >>> from datetime import datetime @@ -15,3 +13,5 @@ $Id$ >>> format.formatDate(time, type='dateTime', variant='medium') u'21.08.2006 17:37:13' + >>> format.formatNumber(17.2) + u'17,2'