Skip to content

Commit 57c2668

Browse files
committed
Fix for export of <Case> when condition is None...
1 parent aefa0b4 commit 57c2668

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lems/model/dynamics.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ def toxml(self):
185185
"""
186186
Exports this object into a LEMS XML object
187187
"""
188-
189-
return (
190-
'<Case condition="{0}" value="{1}"'.format(self.condition, self.value)
191-
+ "/>"
188+
cond = (
189+
' condition="{0}"'.format(self.condition)
190+
if self.condition is not None
191+
else ""
192192
)
193+
return '<Case{0} value="{1}"'.format(cond, self.value) + "/>"
193194

194195

195196
class ConditionalDerivedVariable(LEMSBase):

0 commit comments

Comments
 (0)