From 82adcf690036fe02795dedb5bb667095c928cb17 Mon Sep 17 00:00:00 2001 From: Bob Leers Date: Tue, 5 Jun 2018 11:53:12 +0200 Subject: [PATCH] [FIX] Runner merge. Builder controls was a dict! Use fr-form-instance as list. --- orbeon_xml_api/builder.py | 8 ++++---- orbeon_xml_api/runner.py | 3 ++- setup.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/orbeon_xml_api/builder.py b/orbeon_xml_api/builder.py index 6673b0e..640486d 100644 --- a/orbeon_xml_api/builder.py +++ b/orbeon_xml_api/builder.py @@ -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) @@ -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 diff --git a/orbeon_xml_api/runner.py b/orbeon_xml_api/runner.py index 83aec04..4ec0d61 100644 --- a/orbeon_xml_api/runner.py +++ b/orbeon_xml_api/runner.py @@ -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) diff --git a/setup.py b/setup.py index 5246df4..f228491 100644 --- a/setup.py +++ b/setup.py @@ -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',