[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_In.py:1.52.6.1 DT_Util.py:1.81.6.1 DT_Var.py:1.41.6.1
Shane Hathaway
shane@digicool.com
Thu, 9 Aug 2001 13:34:01 -0400
Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv29115/lib/python/DocumentTemplate
Modified Files:
Tag: NR-branch
DT_In.py DT_Util.py DT_Var.py
Log Message:
Sync NR-branch with trunk. Sorry about so many checkin messages...
=== Zope/lib/python/DocumentTemplate/DT_In.py 1.52 => 1.52.6.1 ===
from DT_InSV import sequence_variables, opt
TupleType=type(())
+StringTypes = (type(''), type(u''))
class InFactory:
blockContinuations=('else',)
@@ -652,14 +653,23 @@
client = sequence[index]
pkw['sequence-index']=index
- if type(client)==TupleType and len(client)==2:
+ t = type(client)
+ if t is TupleType and len(client)==2:
client=client[1]
- if mapping: push(client)
- else: push(InstanceDict(client, md))
+ if mapping:
+ pushed = 1
+ push(client)
+ elif t in StringTypes:
+ pushed = 0
+ else:
+ pushed = 1
+ push(InstanceDict(client, md))
try: append(render(section, md))
- finally: pop(1)
+ finally:
+ if pushed:
+ pop()
if index==first: pkw['sequence-start']=0
@@ -744,14 +754,23 @@
client = sequence[index]
pkw['sequence-index']=index
- if type(client)==TupleType and len(client)==2:
+ t = type(client)
+ if t is TupleType and len(client)==2:
client=client[1]
- if mapping: push(client)
- else: push(InstanceDict(client, md))
+ if mapping:
+ pushed = 1
+ push(client)
+ elif t in StringTypes:
+ pushed = 0
+ else:
+ pushed = 1
+ push(InstanceDict(client, md))
try: append(render(section, md))
- finally: pop()
+ finally:
+ if pushed:
+ pop()
if index==0: pkw['sequence-start']=0
result = ''.join(result)
=== Zope/lib/python/DocumentTemplate/DT_Util.py 1.81 => 1.81.6.1 ===
try:
get(inst, name)
- except (AttributeError, ValidationError):
+ except (AttributeError, ValidationError, KeyError):
return 0
else:
return 1
=== Zope/lib/python/DocumentTemplate/DT_Var.py 1.41 => 1.41.6.1 ===
def structured_text(v, name='(Unknown name)', md={}):
global StructuredText
- if StructuredText is None: import StructuredText
- return str(StructuredText.html_with_references(str(v), 3))
+ if StructuredText is None: from StructuredText import html_with_references
+ return str(html_with_references(str(v),level=3,header=0))
def sql_quote(v, name='(Unknown name)', md={}):
"""Quote single quotes in a string by doubling them.