Skip to content

Commit

Permalink
[FIX] Runner merge. Builder controls was a dict! Use fr-form-instance…
Browse files Browse the repository at this point in the history
… as list.
  • Loading branch information
bobslee committed Jun 5, 2018
1 parent 932547a commit 82adcf6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions orbeon_xml_api/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def __init__(self, xml, lang='en', **kwargs):
self.sanitized_control_names = {}
self.set_sanitized_control_names()

self._form = {}
self.set_form()
self.form_instance = []
self.set_form_instance()

def set_xml_root(self):
self.xml_root = generate_xml_root(self.xml)
Expand Down Expand Up @@ -153,13 +153,13 @@ def set_control_objects(self, control_objects):
def set_context(self, context):
self.context = context

def set_form(self):
def set_form_instance(self):
query = "//*[@id='fr-form-instance']/form/*"
res = self.xml_root.xpath(query)

for root_el in res:
for element in root_el.iter():
self._form[element.tag] = element
self.form_instance.append(element)

def add_control_object(self, name, control_obj):
supported = False
Expand Down
3 changes: 2 additions & 1 deletion orbeon_xml_api/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def merge(self, builder_obj, **kwargs):

parents = {}

for tag, element in builder_obj.controls.iteritems():
for element in builder_obj.form_instance:
tag = element.tag
if tag in self.builder.controls.keys():
# k_: Known elements (present in original runner/builder)
k_control = self.builder.controls.get(tag, False)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='orbeon-xml-api',
version='0.1.0.dev24',
version='0.1.0.dev25',
description='A Python object API for Orbeon XML',
url='https://github.com/bobslee/orbeon-xml-api',
author='Bob Leers',
Expand Down

0 comments on commit 82adcf6

Please sign in to comment.