Hi all,

got a tiny fix for i18n number parsing. Did not work

for e.g. the german locale so fixed the bug. Maybe

someone wants to check it in if there is no mistake

in my bug fix (if I'm not entirely mistaken and there

is actually a bug in the code).

--- format.py

+++ format.py

@@ -277,9 +277,10 @@

type = int

if self.symbols['decimal'] in num_str:

type = float

+ num_str = num_str.replace(self.symbols['decimal'], '.')

if self.symbols['exponential'] in num_str:

type = float

- num_str.replace(self.symbols['exponential'], 'E')

+ num_str = num_str.replace(self.symbols['exponential'], 'E')

return sign*type(num_str)

def _format_integer(self, integer, pattern):


1. string replacement does not perform in-place modification of

the instance but returns a copy of the string with the replacement


2. float constructor does not accept locale specific fraction delimiter

so we need to replace it by the standard '.' to get the string parsed



Sven Schomaker

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to