[FIX] Use an alternative for the locale.RADIXCHAR if this one doesn't exist

lp bug: https://launchpad.net/bugs/400614 fixed

bzr revid: stephane@openerp.com-20091007123807-qsn2uk6jarosd7nz
This commit is contained in:
Stephane Wirtel 2009-10-07 14:38:07 +02:00
parent f590b74318
commit 3c28a101b9
1 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import reportlab
from lxml import etree
import copy
import tools
import locale
_regex = re.compile('\[\[(.+?)\]\]')
@ -133,6 +134,15 @@ units = [
def unit_get(size):
global units
if size:
if size.find('.') == -1:
decimal_point = '.'
try:
decimal_point = locale.RADIXCHAR
except:
decimal_point = locale.localeconv()['decimal_point']
size = size.replace(decimal_point, '.')
for unit in units:
res = unit[0].search(size, 0)
if res: