# HG changeset patch # User paulb # Date 1106672447 0 # Node ID ad08b0ca3e980157cf4866384849e95b94250fa5 # Parent 7ef971673d9370974974ec502898a55ab373e598 [project @ 2005-01-25 17:00:44 by paulb] Added a simple WebDAV interface to the database. diff -r 7ef971673d93 -r ad08b0ca3e98 examples/Common/Configurator/Resources/config_dav.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Common/Configurator/Resources/config_dav.xsl Tue Jan 25 17:00:47 2005 +0000 @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + / + + + // + + + + + 2004-10-13T23:57:00Z + + + + + + + + + + + + + + + text/html + + + HTTP/1.1 200 OK + + + + + diff -r 7ef971673d93 -r ad08b0ca3e98 examples/Common/Configurator/__init__.py --- a/examples/Common/Configurator/__init__.py Tue Jan 25 17:00:34 2005 +0000 +++ b/examples/Common/Configurator/__init__.py Tue Jan 25 17:00:47 2005 +0000 @@ -64,6 +64,28 @@ fields = XSLForms.Fields.Fields(encoding=self.encoding, values_are_lists=1) parameters = trans.get_fields_from_body(self.encoding) documents = fields.make_documents(parameters.items()) + elif method == "PROPFIND": + dav_xsl = os.path.join(self.resource_dir, "config_dav.xsl") + database_xml = os.path.join(self.resource_dir, "config_database.xml") + database = libxml2dom.parse(database_xml) + + # Process the path. + + parts = trans.get_path_info().split("/") + if not parts[-1]: + del parts[-1] + + start = parts[-1] + path = "/".join(parts) + proc = XSLOutput.Processor([dav_xsl], parameters={ + "path" : path, + "start" : start + }) + + trans.set_response_code(207) + proc.send_output(trans.get_response_stream(), trans.get_response_stream_encoding(), + database) + raise WebStack.Generic.EndOfResponse else: trans.set_response_code(405) raise WebStack.Generic.EndOfResponse @@ -101,7 +123,7 @@ database_xsl = os.path.join(self.resource_dir, "config_database.xsl") database_xml = os.path.join(self.resource_dir, "config_database.xml") - proc = XSLOutput.Processor([database_xsl], {"database" : database_xml}) + proc = XSLOutput.Processor([database_xsl], references={"database" : database_xml}) configuration = proc.get_result(configuration) # Start the response.