SupyML: make the <while> works and fix testWhile

master
Valentin Lorentz 2010-11-14 10:04:18 +01:00
parent a486749808
commit 09fb7b36ab
2 changed files with 6 additions and 3 deletions

View File

@ -170,12 +170,15 @@ class SupyMLParser:
raise LoopTypeIsMissing(node.toxml())
elif loopType is None:
loopType = childNode.nodeName
loopCond = childNode.toxml()[len('<while>'):-len('</while>')]
loopCond = childNode.toxml()
loopCond = loopCond[len(loopType+'<>'):-len(loopType+'</>')]
else:
loopContent += childNode.toxml()
if loopType == 'while':
try:
while utils.str.toBool(self._parse(loopCond, variables, True)):
while utils.str.toBool(self._parse(loopCond, variables,
True).split(': ')[1]):
loopContent = '<echo>%s</echo>' % loopContent
output += self._parse(loopContent)
except AttributeError: # toBool() failed
pass

View File

@ -115,7 +115,7 @@ class SupyMLTestCase(ChannelPluginTestCase):
'</echo>'
'</loop>'
'</echo>',
'barbar')
'bar')
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: