[Zope-Checkins] CVS: Zope2 - DT_HTML.py:1.27 DT_Let.py:1.11 DT_String.py:1.44 DT_Util.py:1.76
shane@digicool.com
shane@digicool.com
Mon, 30 Apr 2001 10:46:02 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory korak:/tmp/cvs-serv10853
Modified Files:
DT_HTML.py DT_Let.py DT_String.py DT_Util.py
Log Message:
Fixed some re's
--- Updated File DT_HTML.py in package Zope2 --
--- DT_HTML.py 2001/04/28 04:59:13 1.26
+++ DT_HTML.py 2001/04/30 14:46:00 1.27
@@ -94,10 +94,10 @@
class dtml_re_class:
""" This needs to be replaced before 2.4. It's a hackaround. """
def search(self, text, start=0,
- name_match=re.compile(r'[\000- ]*[a-zA-Z]+[\000- ]*').match,
- end_match=re.compile(r'[\000- ]*(/|end)', re.I).match,
- start_search=re.compile(r'[<&]').search,
- ent_name=re.compile(r'[-a-zA-Z0-9_.]+').match,
+ name_match=re.compile('[\000- ]*[a-zA-Z]+[\000- ]*').match,
+ end_match=re.compile('[\000- ]*(/|end)', re.I).match,
+ start_search=re.compile('[<&]').search,
+ ent_name=re.compile('[-a-zA-Z0-9_.]+').match,
find=find,
strip=strip,
replace=replace,
@@ -224,7 +224,7 @@
return dtml_re_class()
parseTag__roles__=()
- def parseTag(self, tagre, command=None, sargs=''):
+ def parseTag(self, match_ob, command=None, sargs=''):
"""Parse a tag using an already matched re
Return: tag, args, command, coname
@@ -236,7 +236,7 @@
coname is the name of a continue tag (e.g. else)
or None otherwise
"""
- tag, end, name, args, =tagre.group(0, 'end', 'name', 'args')
+ tag, end, name, args = match_ob.group(0, 'end', 'name', 'args')
args=strip(args)
if end:
if not command or name != command.name:
@@ -263,7 +263,7 @@
def SubTemplate(self, name): return HTML('', __name__=name)
varExtra__roles__=()
- def varExtra(self,tagre): return 's'
+ def varExtra(self, match_ob): return 's'
manage_edit__roles__=()
def manage_edit(self,data,REQUEST=None):
--- Updated File DT_Let.py in package Zope2 --
--- DT_Let.py 2001/04/28 04:59:28 1.10
+++ DT_Let.py 2001/04/30 14:46:00 1.11
@@ -154,8 +154,8 @@
def parse_let_params(text,
result=None,
tag='let',
- parmre=re.compile(r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
- qparmre=re.compile(r'([\000- ]*([^\000- ="]+)="([^"]*)")'),
+ parmre=re.compile('([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
+ qparmre=re.compile('([\000- ]*([^\000- ="]+)="([^"]*)")'),
**parms):
result=result or []
--- Updated File DT_String.py in package Zope2 --
--- DT_String.py 2001/04/28 07:20:28 1.43
+++ DT_String.py 2001/04/30 14:46:00 1.44
@@ -155,18 +155,18 @@
tagre__roles__=()
def tagre(self):
return re.compile(
- r'%(' # beginning
- r'(?P<name>[a-zA-Z0-9_/.-]+)' # tag name
- r'('
- r'[\000- ]+' # space after tag name
- r'(?P<args>([^)"]+("[^"]*")?)*)' # arguments
- r')?'
- r')(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])' # end
- , re.I)
+ '%\\(' # beginning
+ '(?P<name>[a-zA-Z0-9_/.-]+)' # tag name
+ '('
+ '[\000- ]+' # space after tag name
+ '(?P<args>([^\\)"]+("[^"]*")?)*)' # arguments
+ ')?'
+ '\\)(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])' # end
+ , re.I)
_parseTag__roles__=()
- def _parseTag(self, tagre, command=None, sargs='', tt=type(())):
- tag, args, command, coname = self.parseTag(tagre,command,sargs)
+ def _parseTag(self, match_ob, command=None, sargs='', tt=type(())):
+ tag, args, command, coname = self.parseTag(match_ob,command,sargs)
if type(command) is tt:
cname, module, name = command
d={}
@@ -179,7 +179,7 @@
return tag, args, command, coname
parseTag__roles__=()
- def parseTag(self, tagre, command=None, sargs=''):
+ def parseTag(self, match_ob, command=None, sargs=''):
"""Parse a tag using an already matched re
Return: tag, args, command, coname
@@ -191,7 +191,7 @@
coname is the name of a continue tag (e.g. else)
or None otherwise
"""
- tag, name, args, fmt =tagre.group(0, 'name', 'args', 'fmt')
+ tag, name, args, fmt = match_ob.group(0, 'name', 'args', 'fmt')
args=args and strip(args) or ''
if fmt==']':
@@ -220,18 +220,18 @@
return tag, args, Var, None
varExtra__roles__=()
- def varExtra(self,tagre):
- return tagre.group('fmt')
+ def varExtra(self, match_ob):
+ return match_ob.group('fmt')
parse__roles__=()
def parse(self,text,start=0,result=None,tagre=None):
if result is None: result=[]
if tagre is None: tagre=self.tagre()
- mo =tagre.search(text,start)
+ mo = tagre.search(text,start)
while mo :
l = mo.start(0)
- try: tag, args, command, coname = self._parseTag(tagre)
+ try: tag, args, command, coname = self._parseTag(mo)
except ParseError, m: self.parse_error(m[0],m[1],text,l)
s=text[start:l]
@@ -243,7 +243,7 @@
tag, l, args, command)
else:
try:
- if command is Var: r=command(args, self.varExtra(tagre))
+ if command is Var: r=command(args, self.varExtra(mo))
else: r=command(args)
if hasattr(r,'simple_form'): r=r.simple_form
result.append(r)
@@ -256,7 +256,7 @@
return result
skip_eol__roles__=()
- def skip_eol(self, text, start, eol=re.compile(r'[ \t]*\n')):
+ def skip_eol(self, text, start, eol=re.compile('[ \t]*\n')):
# if block open is followed by newline, then skip past newline
mo =eol.match(text,start)
if mo is not None:
@@ -281,7 +281,7 @@
if mo is None: self.parse_error('No closing tag', stag, text, sloc)
l = mo.start(0)
- try: tag, args, command, coname= self._parseTag(tagre,scommand,sa)
+ try: tag, args, command, coname= self._parseTag(mo,scommand,sa)
except ParseError, m: self.parse_error(m[0],m[1], text, l)
if command:
@@ -320,7 +320,7 @@
if mo is None: self.parse_error('No closing tag', stag, text, sloc)
l = mo.start(0)
- try: tag, args, command, coname= self._parseTag(tagre,scommand,sa)
+ try: tag, args, command, coname= self._parseTag(mo,scommand,sa)
except ParseError, m: self.parse_error(m[0],m[1], text, l)
start=l+len(tag)
--- Updated File DT_Util.py in package Zope2 --
--- DT_Util.py 2001/04/28 04:58:53 1.75
+++ DT_Util.py 2001/04/30 14:46:00 1.76
@@ -339,14 +339,10 @@
def parse_params(text,
result=None,
tag='',
- unparmre=re.compile(
- r'([\000- ]*([^\000- ="]+))'),
- qunparmre=re.compile(
- r'([\000- ]*("[^"]*"))'),
- parmre=re.compile(
- r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
- qparmre=re.compile(
- r'([\000- ]*([^\000- ="]+)="([^"]*)")'),
+ unparmre=re.compile('([\000- ]*([^\000- ="]+))'),
+ qunparmre=re.compile('([\000- ]*("[^"]*"))'),
+ parmre=re.compile('([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
+ qparmre=re.compile('([\000- ]*([^\000- ="]+)="([^"]*)")'),
**parms):
"""Parse tag parameters