[Pywps-commits] r829 - in branches/pywps-3.0: . doc/examples doc/examples/clients pywps pywps/Parser pywps/Process pywps/Wps

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 19 14:46:46 CEST 2009


Author: jachym
Date: 2009-05-19 14:46:45 +0200 (Tue, 19 May 2009)
New Revision: 829

Added:
   branches/pywps-3.0/doc/examples/clients/ultimatequestion-WPSjs.html
   branches/pywps-3.0/doc/examples/wps.cgi
Modified:
   branches/pywps-3.0/doc/examples/clients/WPS.js
   branches/pywps-3.0/pywps/Exceptions.py
   branches/pywps-3.0/pywps/Parser/Execute.py
   branches/pywps-3.0/pywps/Process/Process.py
   branches/pywps-3.0/pywps/Wps/Execute.py
   branches/pywps-3.0/pywps/Wps/GetCapabilities.py
   branches/pywps-3.0/pywps/Wps/Response.py
   branches/pywps-3.0/setup.py
   branches/pywps-3.0/wps.py
Log:
merged up to rev 828 from trunk

Modified: branches/pywps-3.0/doc/examples/clients/WPS.js
===================================================================
--- branches/pywps-3.0/doc/examples/clients/WPS.js	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/doc/examples/clients/WPS.js	2009-05-19 12:46:45 UTC (rev 829)
@@ -158,7 +158,7 @@
      * Property: timeOut
      * {Integer}, ms
      */
-    timeOut: 5000,
+    timeOut: 10000,
 
     /**
      * Property: statusLocation
@@ -316,20 +316,23 @@
         this.responseText = resp.responseText;
         var dom = resp.responseXML ? resp.responseXML : OpenLayers.parseXMLString(resp.responseText);
         this.responseDOM = dom;
-        this.title = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
+        this.title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS, "Title")[0].firstChild.nodeValue;
         this.abstract = null;
         try {
-            this.abstract = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
+            this.abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS, "Abstract")[0].firstChild.nodeValue;
         } catch(e) {}
 
         // describeProcess Get, Post
         // execute Get, Post
-        var operationsMetadataNode = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "OperationsMetadata")[0];
-        var operationsMetadata = OpenLayers.Ajax.getElementsByTagNameNS(operationsMetadataNode,this.owsNS, this.owsPref, "Operation");
+        var operationsMetadataNode = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS, "OperationsMetadata")[0];
+        var operationsMetadata = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(operationsMetadataNode, this.owsNS, "Operation");
         for (var i = 0; i < operationsMetadata.length; i++) {
-            var operationName = operationsMetadata[i].getAttribute("name");
-            var get = OpenLayers.Ajax.getElementsByTagNameNS(operationsMetadata[i],this.owsNS, this.owsPref, "Get")[0].getAttributeNS(this.xlinkNS, xlink.wpsPref, "href");
-            var post = OpenLayers.Ajax.getElementsByTagNameNS(operationsMetadata[i],this.owsNS, this.owsPref, "Post")[0].getAttributeNS(this.xlinkNS, xlink.wpsPref, "href");
+            var operationNameNode = operationsMetadata[i].getAttribute("name");
+            var getNode = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(operationsMetadata[i],this.owsNS, "Get")[0];
+           
+            var get = OpenLayers.Format.XML.prototype.getAttributeNS(getNode,this.xlinkNS, "href");
+            var postNode = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(operationsMetadata[i],this.owsNS, "Post")[0];
+            var post = OpenLayers.Format.XML.prototype.getAttributeNS(postNode,this.xlinkNS, "href");
 
             switch(operationName.toLowerCase()) {
                 case "getcapabilities": this.getCapabilitiesUrlGet = get;
@@ -345,16 +348,16 @@
         }
 
         // processes
-        var processesNode = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "ProcessOfferings")[0];
-        var processes = OpenLayers.Ajax.getElementsByTagNameNS(processesNode,this.wpsNS, this.wpsPref, "Process");
+        var processesNode = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS, "ProcessOfferings")[0];
+        var processes = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processesNode,this.wpsNS,  "Process");
         for (var i = 0; i < processes.length; i++) {
-            var identifier = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
-            var title = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
+            var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Identifier")[0].firstChild.nodeValue;
+            var title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Title")[0].firstChild.nodeValue;
             var abstract = null;
             try {
-                abstract = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
+                abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Abstract")[0].firstChild.nodeValue;
             } catch(e) {}
-            var version = processes[i].getAttributeNS(this.wpsNS, this.wpsPref, version);
+            var version = OpenLayers.Format.XML.prototype.getAttributeNS(processes[i],this.wpsNS, "version");
             var process = new OpenLayers.WPS.Process({identifier:identifier,title: title, abstract: abstract, version: version,wps:this});
             this.addProcess(process);
         }
@@ -401,12 +404,12 @@
 
         var processes = dom.getElementsByTagName("ProcessDescription");
         for (var i = 0; i < processes.length; i++) {
-            var identifier = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
+            var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Identifier")[0].firstChild.nodeValue;
             var process = this.getProcess(identifier);
 
-            process.title = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
-            process.abstract = OpenLayers.Ajax.getElementsByTagNameNS(processes[i],this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
-            process.version = processes[i].getAttributeNS(this.wpsNS, this.wpsPref, "processVersion");
+            process.title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Title")[0].firstChild.nodeValue;
+            process.abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(processes[i],this.owsNS,  "Abstract")[0].firstChild.nodeValue;
+            process.version = OpenLayers.Format.XML.prototype.getAttributeNS(processes[i],this.wpsNS, "processVersion");
 
             /* parseInputs */
             process.inputs = process.inputs.concat(process.inputs,
@@ -457,10 +460,10 @@
             }
 
             // metadata
-            var metadataDom = OpenLayers.Ajax.getElementsByTagNameNS(puts[i],this.owsNS, this.owsPref, "Metadata");
+            var metadataDom = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(puts[i],this.owsNS,  "Metadata");
             var metadata = {};
             if (metadataDom.length>0) {
-                metadataDom[metadataDom[i].getAttributeNS(this.xlinkNS, xlink.wpsPref, "title")] = metadataDom[i].firstChild.nodeValue;
+                metadataDom[OpenLayers.Format.XML.prototype.getAttributeNS(metadataDom[i],this.xlinkNS, "title")] = metadataDom[i].firstChild.nodeValue;
             }
             wpsputs[wpsputs.length-1].metadata = metadata;
         }
@@ -475,11 +478,11 @@
      * dom - {DOM}  input
      */
     parseDescribeComplexPuts: function(dom){
-        var identifier = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
-        var title = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
+        var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Identifier")[0].firstChild.nodeValue;
+        var title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Title")[0].firstChild.nodeValue;
         var abstract = null;
         try {
-            abstract = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
+            abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Abstract")[0].firstChild.nodeValue;
         } catch(e) {}
 
         var formats = [];
@@ -494,13 +497,13 @@
         if (cmplxData.length > 0) {
             // default format first
             var formatsNode = cmplxData[0].getElementsByTagName("Default")[0].getElementsByTagName("Format")[0];
-            var frmts = OpenLayers.Ajax.getElementsByTagNameNS(formatsNode,this.owsNS, this.owsPref, "MimeType")[0].firstChild.nodeValue;
+            var frmts = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(formatsNode,this.owsNS,  "MimeType")[0].firstChild.nodeValue;
             formats.push(frmts);
             
             // all otheres afterwards
             var supportedFormats = cmplxData[0].getElementsByTagName("Supported")[0].getElementsByTagName("Format");
             for (var i = 0; i < supportedFormats.length; i++) {
-                var format = OpenLayers.Ajax.getElementsByTagNameNS(supportedFormats[i],this.owsNS, this.owsPref, "MimeType")[0].firstChild.nodeValue;
+                var format = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(supportedFormats[i],this.owsNS,  "MimeType")[0].firstChild.nodeValue;
                 if (OpenLayers.WPS.Utils.isIn(formats,format) == false) {
                     formats.push(format);
                 }
@@ -529,11 +532,11 @@
      * dom - {DOM} input
      */
     parseDescribeBoundingBoxPuts: function(dom){
-        var identifier = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
-        var title = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
+        var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Identifier")[0].firstChild.nodeValue;
+        var title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Title")[0].firstChild.nodeValue;
         var abstract = null;
         try {
-            abstract = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
+            abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Abstract")[0].firstChild.nodeValue;
         } catch(e) {}
         var crss = [];
 
@@ -545,12 +548,12 @@
         }
 
         // default first
-        crss.push(domcrss.getElementsByTagName("Default")[0].getElementsByTagName("CRS")[0].getAttributeNS(this.xlinkNS, xlink.wpsPref, "href"));
+        crss.push(OpenLayers.Format.XML.prototype.getAttributeNS(domcrss.getElementsByTagName("Default")[0].getElementsByTagName("CRS")[0],this.xlinkNS,  "href"));
 
         // supported afterwards
         var supported = domcrss.getElementsByTagName("Supported");
         for (var i = 0; i < supported.length; i++) {
-            var crs = supported[i].getElementsByTagName("CRS")[0].getAttributeNS(this.xlinkNS, xlink.wpsPref, "href");
+            var crs = OpenLayers.Format.XML.prototype.getAttributeNS(supported[i].getElementsByTagName("CRS")[0],this.xlinkNS, xlink.wpsPref, "href");
             if (OpenLayers.WPS.Utils.isIn(crss,crs) == false) {
                 crss.push(crs);
             }
@@ -574,11 +577,11 @@
      */
     parseDescribeLiteralPuts: function(dom){
 
-        var identifier = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
-        var title = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Title")[0].firstChild.nodeValue;
+        var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Identifier")[0].firstChild.nodeValue;
+        var title = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Title")[0].firstChild.nodeValue;
         var abstract = null;
         try {
-            abstract = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Abstract")[0].firstChild.nodeValue;
+            abstract = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Abstract")[0].firstChild.nodeValue;
         } catch(e) {}
 
         var allowedValues = [];
@@ -587,17 +590,17 @@
         var inputs = [];
         
         // dataType
-        var dataType = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "DataType")[0];
+        var dataType = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "DataType")[0];
         if (dataType) {
             type = dataType.firstChild.nodeValue.toLowerCase();
         }
         // anyValue
-        if (OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "AnyValue").length > 0){
+        if (OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "AnyValue").length > 0){
             allowedValues = ["*"];
         }
         // allowedValues
-        else if (OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "AllowedValues").length > 0) {
-            var nodes = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, 
+        else if (OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "AllowedValues").length > 0) {
+            var nodes = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  
                                     "AllowedValues")[0].childNodes;
             // allowedValues
             for (var i = 0; i < nodes.length; i++) {
@@ -607,8 +610,8 @@
                 }
                 // range
                 else if (nodes[i].localName == "Range") {
-                    var min = OpenLayers.Ajax.getElementsByTagNameNS(nodes[i],this.owsNS, this.owsPref, "MinimumValue")[0].firstChild.nodeValue;
-                    var max = OpenLayers.Ajax.getElementsByTagNameNS(nodes[i],this.owsNS, this.owsPref, "MaximumValue")[0].firstChild.nodeValue;
+                    var min = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(nodes[i],this.owsNS,  "MinimumValue")[0].firstChild.nodeValue;
+                    var max = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(nodes[i],this.owsNS, "MaximumValue")[0].firstChild.nodeValue;
                     allowedValues.push([min,max]);
                 }
             }
@@ -734,17 +737,22 @@
         }
         var dom = resp.responseXML ? resp.responseXML : OpenLayers.parseXMLString(text);
         this.responseDOM = dom;
-        this.statusLocation = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "ExecuteResponse")[0].getAttribute("statusLocation");
-        var identifier = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
+        try {
+            this.statusLocation = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "ExecuteResponse")[0].getAttribute("statusLocation");
+        }
+        catch(e) {
+            this.statusLocation = null;
+        }
+        var identifier = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Identifier")[0].firstChild.nodeValue;
         var process = this.getProcess(identifier);
-        var status = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "Status");
+        var status = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "Status");
         if (status.length > 0) { this.parseStatus(status[0]); }
 
         if (this.status == "ProcessSucceeded") {
-            var procOutputsDom = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "ProcessOutputs");
+            var procOutputsDom = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "ProcessOutputs");
             var outputs = null;
             if (procOutputsDom.length) {
-                outputs = OpenLayers.Ajax.getElementsByTagNameNS(procOutputsDom[0],this.wpsNS, this.wpsPref, "Output"); 
+                outputs = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(procOutputsDom[0],this.wpsNS,  "Output"); 
             }
             for (var i = 0; i < outputs.length; i++) {
                 this.parseExecuteOutput(process,outputs[i]);
@@ -759,11 +767,11 @@
         
         if (this.status != "ProcessFailed" && this.status != "ProcessSucceeded") {
             if (this.statusLocation) {
-
-                window.setTimeout("OpenLayers.WPS.Utils.loadGet(OpenLayers.WPS.WPS.instances["+this.id+"].statusLocation,"+
-                                "{}, OpenLayers.WPS.instances["+this.id+"].parseExecute,"+
-                                "   OpenLayers.WPS.instances["+this.id+"].onException, "+
-                                "   OpenLayers.WPS.instances["+this.id+"])", this.timeOut);
+                
+                window.setTimeout("OpenLayers.Request.GET({url:OpenLayers.WPS.instances["+this.id+"].statusLocation,"+
+                                "params:{},success: OpenLayers.WPS.instances["+this.id+"].parseExecute,"+
+                                "failure: OpenLayers.WPS.instances["+this.id+"].onException, "+
+                                "scope: OpenLayers.WPS.instances["+this.id+"]})", this.timeOut);
             }
         }
     },
@@ -778,17 +786,16 @@
      * dom - {DOMelement} <wps:Output />
      */
     parseExecuteOutput: function(process,dom) {
-        var identifier  = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS, this.owsPref, "Identifier")[0].firstChild.nodeValue;
+        var identifier  = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,  "Identifier")[0].firstChild.nodeValue;
         var output = process.getOutput(identifier);
-
-        var literalData = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "LiteralData");
-        var complexData = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "ComplexData");
-        var boundingBoxData = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "BoundingBox");
-	var reference = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.wpsNS, this.wpsPref, "Reference");
+        var literalData = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "LiteralData");
+        var complexData = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "ComplexData");
+        var boundingBoxData = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "BoundingBox");
+	var reference = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.wpsNS,  "Reference");
 	
 
 	if (reference.length > 0) {
-            output.setValue(reference[0].getAttributeNS(this.xlinkNS, xlink.wpsPref, "href"));
+            output.setValue(OpenLayers.Format.XML.prototype.getAttributeNS(reference[0],this.xlinkNS, "href"));
         }
         else if(literalData.length > 0) {
             output.setValue(literalData[0].firstChild.nodeValue);
@@ -808,8 +815,8 @@
         }
         else if (boundingBoxData.length > 0 ) {
 	    var minxy; var maxxy;
-	    minxy = OpenLayers.Ajax.getElementsByTagNameNS(boundingBoxData,this.owsNS, this.owsPref, "LowerCorner");
-	    maxxy = OpenLayers.Ajax.getElementsByTagNameNS(boundingBoxData,this.owsNS, this.owsPref, "UpperCorner");
+	    minxy = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(boundingBoxData,this.owsNS,  "LowerCorner");
+	    maxxy = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(boundingBoxData,this.owsNS,  "UpperCorner");
 	    var crs = boundingBoxData.getAttribute("crs");
 	    var dimensions = boundingBoxData.getAttribute("dimensions");
             output.setValue([minxy.split(" ")[0],minxy.split(" ")[1],
@@ -845,7 +852,7 @@
      */
     parseStatus: function(status) {
         for (var k in this.statusEvents) {
-            var dom = OpenLayers.Ajax.getElementsByTagNameNS(status,this.wpsNS, this.wpsPref, k);
+            var dom = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(status,this.wpsNS,  k);
             if (dom.length>0) {
                 this.setStatus(k,
                             dom[0].firstChild.nodeValue,
@@ -881,13 +888,13 @@
      * 
      */
     parseProcessFailed: function(process,dom) {
-        var Exception = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS,this.owsPref,"Exception");
+        var Exception = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,"Exception");
         var code;
         if (Exception.length) {
             code = Exception[0].getAttribute('exceptionCode');
         }
         var text;
-        var ExceptionText = OpenLayers.Ajax.getElementsByTagNameNS(dom,this.owsNS,this.owsPref,"ExceptionText");
+        var ExceptionText = OpenLayers.Format.XML.prototype.getElementsByTagNameNS(dom,this.owsNS,"ExceptionText");
         if (ExceptionText.length) {
             try {
                 text = ExceptionText[0].firstChild.nodeValue;
@@ -926,7 +933,7 @@
     getProcess: function(identifier) {
         
         for (var i = 0; i < this.processes.length; i++) {
-            if (this.processes[i].identifier == identifier) {
+            if (this.processes[i] && this.processes[i].identifier == identifier) {
                 return this.processes[i];
             }
         }
@@ -1276,8 +1283,8 @@
                                 '</wps:DataInputs>'+
                                 '<wps:ResponseForm>'+
                                 '<wps:ResponseDocument wps:lineage="false" '+
-                                'wps:storeExecuteResponse="true" '+
-                                'wps:status="$STORE_AND_STATUS$">'+
+                                'storeExecuteResponse="true" '+
+                                'status="$STORE_AND_STATUS$">'+
                                 "$OUTPUT_DEFINITIONS$"+
                                 '</wps:ResponseDocument>'+
                                 '</wps:ResponseForm>'+

Copied: branches/pywps-3.0/doc/examples/clients/ultimatequestion-WPSjs.html (from rev 828, trunk/doc/examples/clients/ultimatequestion-WPSjs.html)

Copied: branches/pywps-3.0/doc/examples/wps.cgi (from rev 828, trunk/doc/examples/wps.cgi)

Modified: branches/pywps-3.0/pywps/Exceptions.py
===================================================================
--- branches/pywps-3.0/pywps/Exceptions.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Exceptions.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -72,6 +72,7 @@
 
 class NoApplicableCode(WPSException):
     def __init__(self,value=None):
+        WPSException.__init__(self,value)
         self.code = "NoApplicableCode"
         self.locator = None
         self.make_xml()

Modified: branches/pywps-3.0/pywps/Parser/Execute.py
===================================================================
--- branches/pywps-3.0/pywps/Parser/Execute.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Parser/Execute.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -154,11 +154,11 @@
                 # is it necessary ?
 
                 outputs[-1]["mimetype"] = \
-                    outputNode.getAttributeNS("*","mimeType")
+                    outputNode.getAttribute("mimeType")
                 outputs[-1]["encoding"] = \
-                    outputNode.getAttributeNS("*","encoding")
+                    outputNode.getAttribute("encoding")
                 outputs[-1]["schema"] = \
-                    outputNode.getAttributeNS("*","schema")
+                    outputNode.getAttribute("schema")
                 outputs[-1]["uom"] = \
                     outputNode.getAttributeNS(self.nameSpace,"uom")
 
@@ -183,13 +183,13 @@
             except IndexError:
                 raise self.wps.exceptions.MissingParameterValue("Identifier")
             form["rawdataoutput"][identifier]["mimetype"] = \
-                    responseFormNode.getAttributeNS("*","mimeType")
+                    responseFormNode.getAttribute("mimeType")
             form["rawdataoutput"][identifier]["encoding"] = \
-                    responseFormNode.getAttributeNS("*","encoding")
+                    responseFormNode.getAttribute("encoding")
             form["rawdataoutput"][identifier]["schema"] = \
-                    responseFormNode.getAttributeNS("*","schema")
+                    responseFormNode.getAttribute("schema")
             form["rawdataoutput"][identifier]["uom"] = \
-                    responseFormNode.getAttributeNS("*","uom")
+                    responseFormNode.getAttributeNS(self.nameSpace,"uom")
         return form
 
     def parseDataInputs(self,inputsNode):

Modified: branches/pywps-3.0/pywps/Process/Process.py
===================================================================
--- branches/pywps-3.0/pywps/Process/Process.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Process/Process.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -24,7 +24,7 @@
 import subprocess
 import time
 import types
-import sys
+import sys,os
 
 class Status:
     """
@@ -165,6 +165,11 @@
             else:
                 statusSupported = False
         self.statusSupported = statusSupported
+
+	# status not supported on windows
+	if os.name == "nt":
+		self.statusSupported = False
+
         self.debug = False
 
         self.status = Status()
@@ -433,13 +438,13 @@
         if stdin:
             idx = stdin.find("\n")
             if 0 < idx <= 60:
-                stdinOut = stdin[:idx]
+                stdinOut = " "+stdin[:idx]
             else:
-                stdinOut = stdin[:60]
+                stdinOut = " "+stdin[:60]
         else:
             stdinOut = ""
 
-        self.message("PyWPS Cmd: %s %s\n" % (cmd.__str__(),stdinOut))
+        self.message("PyWPS Cmd: %s\n" % (" ".join(cmd)+stdinOut))
 
         try:
             subprocessstdin = None
@@ -473,7 +478,15 @@
         """
 
         if self.debug or force and self.logFile:
-            self.logFile.write(msg)
+            if type(self.logFile) == type(""):
+                try:
+                    f = open(self.logFile,"w")
+                    f.write(msg)
+                    f.close()
+                except:
+                    print >>sys.stderr, "PyWPS WARNING: Could not write to logfile [%s]" % self.logFile
+            else:
+                self.logFile.write(msg)
         return
 
     def getInput(self,identifier):

Modified: branches/pywps-3.0/pywps/Wps/Execute.py
===================================================================
--- branches/pywps-3.0/pywps/Wps/Execute.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Wps/Execute.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -40,6 +40,7 @@
     succeeded = "processsucceeded"
     paused = "processpaused"
     failed = "processfailed"
+    curdir = os.path.abspath(os.path.curdir)
 
     # running process id
     pid = None
@@ -205,12 +206,11 @@
 
             # this is child process, parent is already gone away
             # redirect stdout, so that apache sends back the response immediately
-            si = open('/dev/null', 'r')
-            so = open('/dev/null', 'a+')
+            si = open(os.devnull, 'r')
+            so = open(os.devnull, 'a+')
             os.dup2(si.fileno(), sys.stdin.fileno())
             os.dup2(so.fileno(), sys.stdout.fileno())
 
-
         # attempt to execute
         try:
 
@@ -229,9 +229,9 @@
         except self.wps.exceptions.WPSException,e:
             # set status to failed
             self.promoteStatus(self.failed,
-                    statusMessage=e.value,
-                    exceptioncode=e.code,
-                    locator=e.locator)
+                     statusMessage=e.value,
+                     exceptioncode=e.code,
+                     locator=e.locator)
 
         except Exception,e:
             # set status to failed
@@ -495,7 +495,6 @@
         {String} exceptioncode - eventually exception
         {String} locator - where the problem occurred
         """
-
         self.statusTime = time.time()
         self.templateProcessor.set("statustime", time.ctime(self.statusTime))
         self.status = status
@@ -911,10 +910,14 @@
         """
         Removes temporary created files and dictionaries
         """
+        os.chdir(self.curdir)
+        def onError(*args):
+            print >>self.logFile, "PYWPS Error: Could not remove temporary dir"
+
         for i in range(len(self.dirsToBeRemoved)):
             dir = self.dirsToBeRemoved[0]
             if os.path.isdir(dir) and dir != "/":
-                RMTREE(dir)
+                RMTREE(dir, onerror=onError)
                 pass
             self.dirsToBeRemoved.remove(dir)
 

Modified: branches/pywps-3.0/pywps/Wps/GetCapabilities.py
===================================================================
--- branches/pywps-3.0/pywps/Wps/GetCapabilities.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Wps/GetCapabilities.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -153,7 +153,6 @@
 
         try: 
             for processName in self.processes.__all__:
-
                 processData = {}
                 try:
                     # dynamic module import from processes dir:

Modified: branches/pywps-3.0/pywps/Wps/Response.py
===================================================================
--- branches/pywps-3.0/pywps/Wps/Response.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/pywps/Wps/Response.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -44,13 +44,18 @@
     statusFiles = STDOUT
     emptyParamRegex = re.compile('( \w+="")|( \w+="None")')
     templateVersionDirectory = None # directory with templates for specified version
+    precompile = 1
+    stdOutClosed = False
 
     def __init__(self,wps):
         self.wps = wps
 
         self.templateVersionDirectory = self.wps.inputs["version"].replace(".","_")
 
-        self.templateManager = TemplateManager(precompile = 1,
+	if os.name == "nt":
+		self.precompile = 0
+
+        self.templateManager = TemplateManager(precompile = self.precompile,
             debug = self.wps.config.getboolean("server","debug"))
 
         if self.wps.inputs["request"] == "getcapabilities":
@@ -70,28 +75,40 @@
                                     "Execute.tmpl")
 
         self.processDir = os.getenv("PYWPS_PROCESSES")
-        if not self.processDir:
-            try: self.processDir = self.wps.getConfigValue("server", "processesPath")
-            except: pass
+        if self.processDir:
+            self.wps.debug("PYWPS_PROCESSES set from environment variable to %s" %self.processDir)
+        else:
+            self.wps.debug("PYWPS_PROCESSES environment variable not set or empty.  Trying to find something in the configuration file")
+            try:
+                self.processDir = self.wps.getConfigValue("server", "processesPath")
+                self.wps.debug("PYWPS_PROCESSES: set from configuration file to [%s]" %self.processDir)
+            except: 
+                self.wps.debug("'processesPath' not found in the 'server' section of pywps configuration file")
 
         if self.processDir:
             import sys
             if self.processDir[-1] == os.path.sep:
                 self.processDir = self.processDir[:-1]
 
-
             try:
-                sys.path.append(os.path.split(self.processDir)[0])
+                sys.path.insert(0,os.path.split(self.processDir)[0])
                 processes = __import__(os.path.split(self.processDir)[-1])
                 self.processes = processes
             except ImportError,e:
                 raise self.wps.exceptions.NoApplicableCode("Could not import processes from the dir [%s]: %s! __init__.py file missing?" % (self.processDir,e))
 
-
             sys.path.append(self.processDir)
         else:
-            import pywps
-            from pywps import processes
+            self.wps.debug("Importing the processes from default (pywps/processes) location")
+            try:
+                import pywps
+            except ImportError,e:
+                raise self.wps.exceptions.NoApplicableCode("Could not import pywps module: %s" % (e))
+            try:
+                from pywps import processes
+                self.wps.debug("PYWPS_PROCESSES: %s" %os.path.abspath(pywps.processes.__path__[-1]))
+            except Exception,e:
+                raise self.wps.exceptions.NoApplicableCode("Could not import pywps.processes module: %s" % (e))
             self.processes = pywps.processes
 
     def getDataTypeReference(self,inoutput):
@@ -131,9 +148,12 @@
 
         for f in fileDes:
 
+	    if f == STDOUT and self.stdOutClosed == True:
+		    continue
+
             if f == STDOUT:
                 print "Content-Type: text/xml"
-                print "Content-Length: %d" % len(self.response)
+                #print "Content-Length: %d" % len(self.response)
                 print ""
 
             # open file
@@ -147,7 +167,10 @@
             if (f != STDOUT):
                 f.close()
 
+	    # remove stdout from fileDes
+	    else: 
+		self.stdOutClosed = True
+
     def cleanEnv(self):
         """Clean possible temporary files etc. created by this request
         type"""
-

Modified: branches/pywps-3.0/setup.py
===================================================================
--- branches/pywps-3.0/setup.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/setup.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -104,6 +104,11 @@
 
     baseDir =  os.path.join(sysconfig.get_python_lib(),
                             name,'Templates')
+
+    for i in range(len(sys.path)):
+        if os.path.split(sys.path[i])[1] == "dist-packages":
+            baseDir =  os.path.join(sys.path[i],
+                                name,'Templates')
     versionDirs = ['1_0_0']
 
     template_files = ['GetCapabilities', 'DescribeProcess','Execute']

Modified: branches/pywps-3.0/wps.py
===================================================================
--- branches/pywps-3.0/wps.py	2009-05-19 10:32:03 UTC (rev 828)
+++ branches/pywps-3.0/wps.py	2009-05-19 12:46:45 UTC (rev 829)
@@ -191,11 +191,11 @@
             if sys.platform == 'win32':
                 self.workingDir = os.path.abspath(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0])))
                 cfgfiles = (os.path.join(self.workingDir,"pywps","default.cfg"),
-                        os.path.join(self.workingDir, "pywps","etc","pywps.cfg"),
-                        os.path.join(os.getenv("HOME"),".pywps.cfg"))
+                        os.path.join(self.workingDir, "pywps","etc","pywps.cfg"))
             else:
                 cfgfiles = (os.path.join(pywps.__path__[0],"default.cfg"),
-                            os.path.join(pywps.__path__[0],"etc", "pywps.cfg"), "/etc/pywps.cfg")
+                            os.path.join(pywps.__path__[0],"etc", "pywps.cfg"), "/etc/pywps.cfg",
+                        os.path.join(os.getenv("HOME"),".pywps.cfg" ))
 
         self.config = ConfigParser.ConfigParser()
         self.config.read(cfgfiles)



More information about the Pywps-commits mailing list