# HG changeset patch # User paulb # Date 1115593865 0 # Node ID 99a4ca4e65da6d191d626e89759ff7b3ff2b2860 # Parent cd84ea94ad3d0fcb4f11808ae62d00bdf7e2821b [project @ 2005-05-08 23:11:05 by paulb] Added support for another fragment type. Introduced element path usage instead of identifying the interesting elements using the field names. This makes the updating of multiple fields more reliable. diff -r cd84ea94ad3d -r 99a4ca4e65da examples/Common/Configurator/__init__.py --- a/examples/Common/Configurator/__init__.py Sun May 08 23:10:00 2005 +0000 +++ b/examples/Common/Configurator/__init__.py Sun May 08 23:11:05 2005 +0000 @@ -58,7 +58,7 @@ # Handle requests for fragments. - if path_info in ("/cpu", "/memory"): + if path_info in ("/cpu", "/memory", "/hard-disks"): text = trans.get_request_stream().read() parameters = {} for text_line in text.split("\r\n"): @@ -128,22 +128,19 @@ template_xml = os.path.join(self.resource_dir, "config_template.xhtml") XSLForms.Prepare.ensure_stylesheet(template_xml, trans_xsl) - if path_info == "/cpu": - trans_xsl = os.path.join(self.resource_dir, "config_output_cpu.xsl") + if path_info in ("/cpu", "/memory", "/hard-disks"): template_xml = os.path.join(self.resource_dir, "config_output.xsl") - XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "cpu-node") - target_field_name = parameters.get("target-field-name", [""])[0] - print "*", target_field_name - stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name) - print "*", stylesheet_parameters["element-path"] - - elif path_info == "/memory": - trans_xsl = os.path.join(self.resource_dir, "config_output_memory.xsl") - template_xml = os.path.join(self.resource_dir, "config_output.xsl") - XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "memory-node") - target_field_name = parameters.get("target-field-name", [""])[0] - print "*", target_field_name - stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name) + if path_info == "/cpu": + trans_xsl = os.path.join(self.resource_dir, "config_output_cpu.xsl") + XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "cpu-node") + elif path_info == "/memory": + trans_xsl = os.path.join(self.resource_dir, "config_output_memory.xsl") + XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "memory-node") + elif path_info == "/hard-disks": + trans_xsl = os.path.join(self.resource_dir, "config_output_harddisks.xsl") + XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "hard-disks-node") + element_path = parameters.get("element-path", [""])[0] + stylesheet_parameters["element-path"] = element_path print "*", stylesheet_parameters["element-path"] stylesheet_parameters["application-url"] = \