Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Fixed templating workflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinTervala authored and JustinTervala committed Jun 21, 2017
1 parent dc7eeae commit 428beb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ def render_step(self, **kwargs):
Args:
kwargs (dict[str]): Arguments to use in the JINJA templating.
"""
if sys.version_info[0] > 2:
content = ElementTree.tostring(self.raw_xml, encoding='unicode', method='xml')
else:
content = ElementTree.tostring(self.raw_xml, method='xml')
t = Template(Markup(content).unescape(), autoescape=True)
xml = t.render(core.config.config.JINJA_GLOBALS, **kwargs)
self._update_xml(step_xml=ElementTree.fromstring(str(xml)))
if self.templated:
if sys.version_info[0] > 2:
content = ElementTree.tostring(self.raw_xml, encoding='unicode', method='xml')
else:
content = ElementTree.tostring(self.raw_xml, method='xml')
t = Template(Markup(content).unescape(), autoescape=True)
xml = t.render(core.config.config.JINJA_GLOBALS, **kwargs)
self._update_xml(step_xml=ElementTree.fromstring(xml))

def set_input(self, new_input):
self.input = validate_app_action_parameters(self.input_api, new_input, self.app, self.action)
Expand Down
1 change: 1 addition & 0 deletions tests/testWorkflows/templatedWorkflowTest.playbook
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<action>repeatBackToMe</action>
<app>HelloWorld</app>
<device>hwTest</device>
<templated>true</templated>
<inputs>
<call>{{outputFrom(steps, -1)}}</call>
</inputs>
Expand Down

0 comments on commit 428beb0

Please sign in to comment.