[Pywps-commits] r492 - in trunk/pywps: . Parser

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jul 7 14:53:42 CEST 2008


Author: sebastianh
Date: 2008-07-07 14:53:42 +0200 (Mon, 07 Jul 2008)
New Revision: 492

Modified:
   trunk/pywps/Exceptions.py
   trunk/pywps/Parser/GetCapabilities.py
Log:
AcceptVersions validation added

Modified: trunk/pywps/Exceptions.py
===================================================================
--- trunk/pywps/Exceptions.py	2008-05-28 08:48:11 UTC (rev 491)
+++ trunk/pywps/Exceptions.py	2008-07-07 12:53:42 UTC (rev 492)
@@ -85,6 +85,14 @@
         self.ExceptionReport.appendChild(self.document.createComment(
             repr(value)))
 
+class VersionNegotiationFailed(WPSException):
+    def __init__(self,value=None):
+        self.code = "VersionNegotiationFailed"
+        self.locator = None
+        self.make_xml()
+        self.ExceptionReport.appendChild(self.document.createComment(
+            repr(value)))
+
 class ServerBusy(WPSException):
     def __init__(self,value=None):
         self.code = "ServerBusy"

Modified: trunk/pywps/Parser/GetCapabilities.py
===================================================================
--- trunk/pywps/Parser/GetCapabilities.py	2008-05-28 08:48:11 UTC (rev 491)
+++ trunk/pywps/Parser/GetCapabilities.py	2008-07-07 12:53:42 UTC (rev 492)
@@ -24,6 +24,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 import xml.dom.minidom
+import pywps.Exceptions as WPSExceptions
 
 from pywps.Parser.Post import Post
 
@@ -114,11 +115,11 @@
         # Mandatory options
         #
 
-        # service (is allready controled)
+        # service (is already controlled)
         if self.unparsedInputs["service"].lower() == "wps":
             self.wps.inputs["service"] = self.unparsedInputs["service"]
 
-        # Request (is allready controled)
+        # Request (is already controlled)
         if self.unparsedInputs["request"].lower() == "getcapabilities":
             self.wps.inputs["request"] = self.unparsedInputs["request"].lower()
 
@@ -132,6 +133,8 @@
                                self.unparsedInputs["acceptversions"].split(",")
         except KeyError,e:
             self.wps.inputs["acceptversions"] = [self.wps.DEFAULT_WPS_VERSION]
+        if self.wps.DEFAULT_WPS_VERSION not in self.wps.inputs["acceptversions"]:
+            raise WPSExceptions.VersionNegotiationFailed
 
         # Language
         try:



More information about the Pywps-commits mailing list