1.1 --- a/examples/Common/Configurator/__init__.py Sun May 08 22:07:29 2005 +0000
1.2 +++ b/examples/Common/Configurator/__init__.py Sun May 08 22:08:32 2005 +0000
1.3 @@ -55,15 +55,23 @@
1.4 documents = fields.make_documents(parameters.items())
1.5 elif method == "POST":
1.6 fields = XSLForms.Fields.Fields(encoding=self.encoding, values_are_lists=1)
1.7 - if path_info == "/cpu":
1.8 +
1.9 + # Handle requests for fragments.
1.10 +
1.11 + if path_info in ("/cpu", "/memory"):
1.12 text = trans.get_request_stream().read()
1.13 parameters = {}
1.14 for text_line in text.split("\r\n"):
1.15 text_parts = text_line.split("=")
1.16 - text_name, text_values = text_parts[0], ["=".join(text_parts[1:])]
1.17 - parameters[text_name] = text_values
1.18 + text_name, text_value = text_parts[0], "=".join(text_parts[1:])
1.19 + if not parameters.has_key(text_name):
1.20 + parameters[text_name] = []
1.21 + parameters[text_name].append(text_value)
1.22 else:
1.23 parameters = trans.get_fields_from_body(self.encoding)
1.24 +
1.25 + # Get the XML representation of the request.
1.26 +
1.27 documents = fields.make_documents(parameters.items())
1.28 print "*", libxml2dom.toString(documents["configuration"])
1.29 else:
1.30 @@ -129,6 +137,15 @@
1.31 stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name)
1.32 print "*", stylesheet_parameters["element-path"]
1.33
1.34 + elif path_info == "/memory":
1.35 + trans_xsl = os.path.join(self.resource_dir, "config_output_memory.xsl")
1.36 + template_xml = os.path.join(self.resource_dir, "config_output.xsl")
1.37 + XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "memory-node")
1.38 + target_field_name = parameters.get("target-field-name", [""])[0]
1.39 + print "*", target_field_name
1.40 + stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name)
1.41 + print "*", stylesheet_parameters["element-path"]
1.42 +
1.43 stylesheet_parameters["application-url"] = \
1.44 "http://%s:%s%s" % (trans.get_server_name(), trans.get_server_port(), trans.get_path_without_query())
1.45