[Pywps-commits] r584 - trunk/pywps/Parser

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 10 10:15:29 CEST 2008


Author: sebastianh
Date: 2008-09-10 10:15:28 +0200 (Wed, 10 Sep 2008)
New Revision: 584

Modified:
   trunk/pywps/Parser/Get.py
Log:
bugfix: omit empty kvp in request string

Modified: trunk/pywps/Parser/Get.py
===================================================================
--- trunk/pywps/Parser/Get.py	2008-09-09 06:40:11 UTC (rev 583)
+++ trunk/pywps/Parser/Get.py	2008-09-10 08:15:28 UTC (rev 584)
@@ -18,6 +18,12 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
+# references used in the comments of this source code:
+# OWS_1-1-0:
+#      OGC Web Services Common Specification
+#      version 1.1.0 with Corrigendum 1
+#      ref.num.: OGC 06-121r3
+
 import types
 from string import split
 from pywps.Parser.Parser import Parser
@@ -56,11 +62,14 @@
         # validation
         for feature in queryString.split("&"):
             feature = feature.strip()
-            key,value = split(feature,"=",maxsplit=1)
-            if value.find("[") == 0:  # if value in brackets:
-                value = value[1:-1]   #    delete brackets
-            keys.append(key)
-            self.unparsedInputs[key.lower()] = value[:maxInputLength]
+            # omit empty KVPs, e.g. due to optional ampersand after the last
+            # KVP in request string (OWS_1-1-0, p.75, sect. 11.2):
+            if not feature == '':
+                key,value = split(feature,"=",maxsplit=1)
+                if value.find("[") == 0:  # if value in brackets:
+                    value = value[1:-1]   #    delete brackets
+                keys.append(key)
+                self.unparsedInputs[key.lower()] = value[:maxInputLength]
 
         try:
             self.checkInputLength()



More information about the Pywps-commits mailing list