[Pywps-commits] r545 - in trunk/pywps: Process WPS processes

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Aug 28 12:43:32 CEST 2008


Author: jachym
Date: 2008-08-28 12:43:32 +0200 (Thu, 28 Aug 2008)
New Revision: 545

Modified:
   trunk/pywps/Process/Process.py
   trunk/pywps/WPS/Execute.py
   trunk/pywps/processes/exampleBufferProcess.py
Log:
Bugfixed: asReference is set in the request, not in the process definition

Modified: trunk/pywps/Process/Process.py
===================================================================
--- trunk/pywps/Process/Process.py	2008-08-26 12:19:25 UTC (rev 544)
+++ trunk/pywps/Process/Process.py	2008-08-28 10:43:32 UTC (rev 545)
@@ -175,35 +175,30 @@
     # --------------------------------------------------------------------
 
     def addComplexOutput(self,identifier,title,abstract=None,
-            metadata=[],formats=[{"mimeType":"text/xml"}],
-            asReference=False):
+            metadata=[],formats=[{"mimeType":"text/xml"}]):
 
         self.outputs[identifier] = InAndOutputs.ComplexOutput(identifier=identifier,
-                title=title,abstract=abstract,
-                metadata=[], formats=formats, asReference=asReference)
+                title=title,abstract=abstract, metadata=[], formats=formats)
 
         return self.outputs[identifier]
 
     def addLiteralOutput(self, identifier, title, abstract=None,
-            uoms=(), type=types.IntType, default=None,
-           asReference=False):
+            uoms=(), type=types.IntType, default=None):
         """
         Add new output item of type LiteralValue to this process
         """
 
         self.outputs[identifier] = InAndOutputs.LiteralOutput(identifier=identifier,
-                title=title, abstract=abstract, dataType=type, uoms=uoms, 
-                asReference=asReference)
+                title=title, abstract=abstract, dataType=type, uoms=uoms)
 
         return self.outputs[identifier]
 
     def addBBoxOutput(self, identifier, title, abstract=None,
-            crs="EPSG:4326", dimensions=2, asReference=False):
+            crs="EPSG:4326", dimensions=2):
         """ Add new output item of type BoundingBoxValue to this process """
 
         self.outputs[identifier] = InAndOutputs.BoundingBoxOutput(identifier=identifier,
-                title=title, abstract=abstract, crss=[crs], dimensions=dimensions, 
-                asReference=asReference)
+                title=title, abstract=abstract, crss=[crs], dimensions=dimensions)
 
         return self.outputs[identifier]
 

Modified: trunk/pywps/WPS/Execute.py
===================================================================
--- trunk/pywps/WPS/Execute.py	2008-08-26 12:19:25 UTC (rev 544)
+++ trunk/pywps/WPS/Execute.py	2008-08-28 10:43:32 UTC (rev 545)
@@ -149,6 +149,9 @@
             # donwload and consolidate data
             self.consolidateInputs()
 
+            # set output data attributes defined in the request
+            self.consolidateOutputs()
+
             self.promoteStatus(self.started,"Process %s started" %\
                     self.process.identifier)
 
@@ -250,6 +253,22 @@
             if not input.value:
                 raise self.wps.exceptions.MissingParameterValue(identifier)
 
+    def consolidateOutputs(self):
+        """Set desired attributes (e.g. asReference) for each output"""
+        if self.wps.inputs["responseform"]["responsedocument"].has_key("outputs"):
+            respOutputs = self.wps.inputs["responseform"]["responsedocument"]["outputs"]
+            for identifier in self.process.outputs:
+                poutput = self.process.outputs[identifier]
+                respOut = None
+                try:
+                    respOut = respOutputs[identifier]
+                except:
+                    continue
+
+                # asReference
+                if respOut.has_key("asReference"):
+                    poutput.asReference = respOut["asReference"]
+
     def onInputProblem(self,what,why):
         """
         This method is used for rewriting onProblem method of each input

Modified: trunk/pywps/processes/exampleBufferProcess.py
===================================================================
--- trunk/pywps/processes/exampleBufferProcess.py	2008-08-26 12:19:25 UTC (rev 544)
+++ trunk/pywps/processes/exampleBufferProcess.py	2008-08-28 10:43:32 UTC (rev 545)
@@ -36,7 +36,7 @@
                              title = "Width")
 
         self.bufferOut = self.addComplexOutput(identifier="buffer",
-                                title="Output buffer file",asReference=True)
+                                title="Output buffer file")
 
         # define outputs
         self.textOut = self.addLiteralOutput(identifier="text",



More information about the Pywps-commits mailing list