From c99d7472a0b8f7702b8c6d45ecb7d5a62a63b908 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 19 Oct 2001 00:11:06 +0000 Subject: [PATCH] Speed ups to the comma/decimal handing problem svn: r482 --- gramps/src/utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gramps/src/utils.py b/gramps/src/utils.py index 7f5d7d47e..a63ee228b 100644 --- a/gramps/src/utils.py +++ b/gramps/src/utils.py @@ -125,10 +125,11 @@ else: # # #------------------------------------------------------------------------- -def txt2fl(st): - if _use_comma: +if _use_comma: + def txt2fl(st): return string.atof(string.replace(st,'.',',')) - else: +else: + def txt2fl(st): return string.atof(string.replace(st,',','.')) #------------------------------------------------------------------------- @@ -136,8 +137,12 @@ def txt2fl(st): # # #------------------------------------------------------------------------- -def fl2txt(fmt,val): - return string.replace(fmt % val, ',', '.') +if _use_comma: + def fl2txt(fmt,val): + return string.replace(fmt % val, ',', '.') +else: + def fl2txt(fmt,val): + return fmt % val #------------------------------------------------------------------------- #