[Zope-Checkins] CVS: Zope2 - Converters.py:1.10.16.1
Andreas Jung
andreas@dhcp165.digicool.com
Mon, 23 Apr 2001 10:41:00 -0400
Update of /cvs-repository/Zope2/lib/python/ZPublisher
In directory yetix:/work/sandboxes/ajung-2_4-ts_regex-exterminiation-branch/lib/python/ZPublisher
Modified Files:
Tag: ajung-2_4-ts_regex-exterminiation-branch
Converters.py
Log Message:
regex free
--- Updated File Converters.py in package Zope2 --
--- Converters.py 2001/01/23 16:48:02 1.10
+++ Converters.py 2001/04/23 14:39:59 1.10.16.1
@@ -84,7 +84,7 @@
##############################################################################
__version__='$Revision$'[11:-2]
-import regex
+import re
from string import atoi, atol, atof, join, split, strip
from types import ListType, TupleType
@@ -93,13 +93,14 @@
else: v=str(v)
return v
-def field2text(v, nl=regex.compile('\r\n\|\n\r').search):
+def field2text(v, nl=re.compile('\r\n\|\n\r').search):
if hasattr(v,'read'): v=v.read()
else: v=str(v)
- l=nl(v)
- if l < 0: return v
+ mo=nl(v)
+ if mo is None: return v
r=[]
s=0
+ l = mo.start(0)
while l >= s:
r.append(v[s:l])
s=l+2