# HG changeset patch # User paulb # Date 1115144074 0 # Node ID ddfd6394614b18cc68a504f2d8949e2a93854447 # Parent db4d937ecc07d54c35799bf6bf7aae5c1866197b [project @ 2005-05-03 18:14:34 by paulb] Introduced handling of "callbacks" by parsing posted text data employing a simple format consisting of field_name=field_value, which then produces a standard XML document that can be fed through the templating system. diff -r db4d937ecc07 -r ddfd6394614b examples/Common/Configurator/__init__.py --- a/examples/Common/Configurator/__init__.py Tue May 03 18:12:06 2005 +0000 +++ b/examples/Common/Configurator/__init__.py Tue May 03 18:14:34 2005 +0000 @@ -46,6 +46,7 @@ # Only obtain field information according to the stated method. method = trans.get_request_method() + path_info = trans.get_path_info() if method == "GET": fields = XSLForms.Fields.Fields(encoding="iso-8859-1", values_are_lists=1) @@ -53,8 +54,15 @@ documents = fields.make_documents(parameters.items()) elif method == "POST": fields = XSLForms.Fields.Fields(encoding=self.encoding, values_are_lists=1) - parameters = trans.get_fields_from_body(self.encoding) + if path_info == "/cpu": + text = trans.get_request_stream().read() + text_parts = text.split("=") + text_name, text_values = text_parts[0], ["=".join(text_parts[1:])] + parameters = {text_name : text_values} + else: + parameters = trans.get_fields_from_body(self.encoding) documents = fields.make_documents(parameters.items()) + print "*", libxml2dom.toString(documents["configuration"]) else: trans.set_response_code(405) raise WebStack.Generic.EndOfResponse