[Zope-Checkins] CVS: Zope2 - DT_Var.py:1.37.78.1
Andreas Jung
andreas@dhcp165.digicool.com
Wed, 18 Apr 2001 12:40:27 -0400
Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory yetix:/work/sandboxes/ajung-2_4-ts_regex-exterminiation-branch/lib/python/DocumentTemplate
Modified Files:
Tag: ajung-2_4-ts_regex-exterminiation-branch
DT_Var.py
Log Message:
regex free
--- Updated File DT_Var.py in package Zope2 --
--- DT_Var.py 2000/09/05 22:03:12 1.37
+++ DT_Var.py 2001/04/18 16:40:26 1.37.78.1
@@ -221,7 +221,7 @@
__version__='$Revision$'[11:-2]
from DT_Util import parse_params, name_param, html_quote, str
-import regex, string, sys, regex
+import re, string, sys
from string import find, split, join, atoi, rfind
from urllib import quote, quote_plus
@@ -373,8 +373,8 @@
except: return ''
def thousands_commas(v, name='(Unknown name)', md={},
- thou=regex.compile(
- "\([0-9]\)\([0-9][0-9][0-9]\([,.]\|$\)\)").search):
+ thou=re.compile(
+ "([0-9])([0-9][0-9][0-9]([,.]\|$))").search):
v=str(v)
vl=split(v,'.')
if not vl: return v
@@ -382,8 +382,9 @@
del vl[0]
if vl: s='.'+join(vl,'.')
else: s=''
- l=thou(v)
- while l >= 0:
+ mo=thou(v)
+ while mo is not None:
+ l = mo.start(0)
v=v[:l+1]+','+v[l+1:]
l=thou(v)
return v+s