[Zope-Checkins] CVS: Zope2 - DT_InSV.py:1.18.24.1
Andreas Jung
andreas@dhcp165.digicool.com
Thu, 19 Apr 2001 13:06:44 -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_InSV.py
Log Message:
added code for temp. support of instances of re.compile() and regex.compile()
passed to teh constructor
--- Updated File DT_InSV.py in package Zope2 --
--- DT_InSV.py 2001/01/16 21:57:19 1.18
+++ DT_InSV.py 2001/04/19 17:06:43 1.18.24.1
@@ -90,6 +90,7 @@
from string import lower, rfind, split, join
from math import sqrt
+import re
TupleType=type(())
try:
import Missing
@@ -199,6 +200,7 @@
return l
def query(self, *ignored):
+ print 'query',ignored
if self.start_name_re is None: raise KeyError, 'sequence-query'
query_string=self.query_string
while query_string and query_string[:1] in '?&':
@@ -207,16 +209,26 @@
query_string=query_string[:-1]
if query_string:
query_string='&%s&' % query_string
- re=self.start_name_re
- l=re.search_group(query_string, (0,))
- if l:
- v=l[1]
- l=l[0]
- query_string=(query_string[:l]+
- query_string[l+len(v)-1:])
+ reg=self.start_name_re
+
+ if type(reg)==type(re.compile("")):
+ mo = reg.search(query_string)
+ if mo is not None:
+ v = mo.group(0)
+ l = mo.start(0)
+ query_string=(query_string[:l]+ query_string[l+len(v)-1:])
+
+ else:
+ l=reg.search_group(query_string, (0,))
+ if l:
+ v=l[1]
+ l=l[0]
+ query_string=(query_string[:l]+ query_string[l+len(v)-1:])
+
query_string='?'+query_string[1:]
else: query_string='?'
self.data['sequence-query']=query_string
+ print 'query-return:',query_string
return query_string