[Pywps-commits] r952 - in trunk: doc/source/configuration doc/source/installation pywps pywps/Parser pywps/Process pywps/Wps tests tests/requests

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 11 08:51:07 CEST 2010


Author: jachym
Date: 2010-06-11 08:51:06 +0200 (Fri, 11 Jun 2010)
New Revision: 952

Modified:
   trunk/doc/source/configuration/index.rst
   trunk/doc/source/installation/index.rst
   trunk/pywps/Parser/DescribeProcess.py
   trunk/pywps/Parser/Execute.py
   trunk/pywps/Parser/GetCapabilities.py
   trunk/pywps/Parser/Post.py
   trunk/pywps/Process/InAndOutputs.py
   trunk/pywps/Soap.py
   trunk/pywps/Wps/Execute.py
   trunk/pywps/response.py
   trunk/tests/perform_requests.py
   trunk/tests/requests/wps_execute_request-literalinput.xml
Log:
soap fixes

Modified: trunk/doc/source/configuration/index.rst
===================================================================
--- trunk/doc/source/configuration/index.rst	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/doc/source/configuration/index.rst	2010-06-11 06:51:06 UTC (rev 952)
@@ -115,18 +115,18 @@
 
 2 - Add this to your site configuration file::
 
-        <Directory /var/www/wps>
-            SetEnv PYWPS_PROCESSES /usr/local/wps/processes
-            SetEnv PYWPS_CFG /usr/local/wps/pywps.cfg
-            SetHandler python-program
-            PythonHandler pywps
-            PythonDebug On
-            PythonPath "sys.path+['/usr/local/pywps-VERSION/']"
-            PythonAutoReload On
-        </Directory>
+            <Directory /var/www/wps>
+                SetEnv PYWPS_PROCESSES /usr/local/wps/processes
+                SetEnv PYWPS_CFG /usr/local/wps/pywps.cfg
+                SetHandler python-program
+                PythonHandler pywps
+                PythonDebug On
+                PythonPath "sys.path+['/usr/local/pywps-VERSION/']"
+                PythonAutoReload On
+            </Directory>
 
-    or you can copy :file:`resources/.htaccess` file to `/var/www/wps` --
-    depends, what you prefer or the system administrator allows you to do.
+or you can copy :file:`resources/.htaccess` file to `/var/www/wps` --
+depends, what you prefer or the system administrator allows you to do.
 
 3 - Copy :file:`resources/pywps.py` to :file:`/var/www/wps`
 
@@ -149,7 +149,7 @@
     file :file:`default.cfg` in directory :file:`pywps`, located in PyWPS
     install location. This is the default configuration file.
 
-    ..note:: Never rewrite or remove this file. Use it onlyas template for
+    .. note:: Never rewrite or remove this file. Use it onlyas template for
         your custom configuration files.
 
 Local PyWPS configuration file

Modified: trunk/doc/source/installation/index.rst
===================================================================
--- trunk/doc/source/installation/index.rst	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/doc/source/installation/index.rst	2010-06-11 06:51:06 UTC (rev 952)
@@ -49,10 +49,10 @@
 R  - http://www.r-project.org - is a language and environment
     for statistical computing and graphics.
 
+.. quick-and-dirty:
 ====================================
 Installation the quick 'n' dirty way
 ====================================
-:label:`Quick and dirty way`
 For installing PyWPS to your server simply unpack the archive to some
 directory. You can also use current repository version.::
 
@@ -110,11 +110,14 @@
     $ ./cgiwps.py
 
 And you should get result like this (which is a mixture of standard output
-and standard error)::
+and standard error):
 
+.. code-block:: xml
+
+
+    PyWPS NoApplicableCode: Locator: None; Value: No query string found.
     Content-type: text/xml
 
-    PyWPS NoApplicableCode: Locator: None; Value: No query string found.
     <?xml version="1.0" encoding="utf-8"?>
     <ExceptionReport version="1.0.0" xmlns="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <Exception exceptionCode="NoApplicableCode">

Modified: trunk/pywps/Parser/DescribeProcess.py
===================================================================
--- trunk/pywps/Parser/DescribeProcess.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Parser/DescribeProcess.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -44,6 +44,9 @@
         self.document = document  # input DOM
 
         firstChild = self.getFirstChildNode(self.document)
+
+        if self.isSoap:
+            firstChild = self.getFirstChildNode(self.document)  # no comments or
         owsNameSpace = pywps.OWS_NAMESPACE
         identifiers = []
         identifierNode = None

Modified: trunk/pywps/Parser/Execute.py
===================================================================
--- trunk/pywps/Parser/Execute.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Parser/Execute.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -43,13 +43,14 @@
     def parse(self,document, initInputs=None):
         """ Parse given XML document """
 
+
         if initInputs:
             self.inputs = initInputs
 
         self.document = document  # input DOM
+        firstChild = self.isSoapFirstChild(self.document)  # no comments or
+                                                            # white spaces
 
-        firstChild = self.getFirstChildNode(self.document)  # no comments or
-                                                            # white spaces
         self.nameSpace = firstChild.namespaceURI    # document namespace
         self.nameSpace = pywps.WPS_NAMESPACE
         self.owsNameSpace = pywps.OWS_NAMESPACE

Modified: trunk/pywps/Parser/GetCapabilities.py
===================================================================
--- trunk/pywps/Parser/GetCapabilities.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Parser/GetCapabilities.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -48,7 +48,11 @@
         versions = []   # accepted versions
         acceptedVersionsNodes = None
         versionNode = None
+
         firstChild = self.getFirstChildNode(self.document)
+        
+        if self.isSoap:
+            firstChild = self.getFirstChildNode(self.document)  # no comments or
         owsNameSpace = pywps.OWS_NAMESPACE
         wpsNameSpace = pywps.WPS_NAMESPACE
 

Modified: trunk/pywps/Parser/Post.py
===================================================================
--- trunk/pywps/Parser/Post.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Parser/Post.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -103,16 +103,10 @@
             except xml.parsers.expat.ExpatError,e:
                 raise pywps.NoApplicableCode(e.message)
         
+
         # get first child
-        firstChild = self.getFirstChildNode(self.document)
+        firstChild = self.isSoapFirstChild(self.document)
 
-        # SOAP ??
-        if Soap.isSoap(firstChild):
-            soapCls = Soap.SOAP(firstChild)
-            firstChild = soapCls.getNode(Soap.soap_env_NS[soapCls.nsIndex],"Body")
-            firstChild = self.getFirstChildNode(firstChild)
-            self.isSoap = True
-
         # check service name
         self.checkService(firstChild)
 
@@ -224,3 +218,19 @@
             maxFileSize = int(maxFileSize)
         return maxFileSize
 
+    def isSoapFirstChild(self,document):
+        """Return first child of the document, if it is SOAP request,
+        return first child of the body envelope
+
+        """
+
+        # SOAP ??
+        firstChild = self.getFirstChildNode(document)
+
+        if Soap.isSoap(firstChild):
+            soapCls = Soap.SOAP(firstChild)
+            firstChild = soapCls.getNode(Soap.soap_env_NS[soapCls.nsIndex],"Body")
+            firstChild = self.getFirstChildNode(firstChild)
+            self.isSoap = True
+
+        return firstChild

Modified: trunk/pywps/Process/InAndOutputs.py
===================================================================
--- trunk/pywps/Process/InAndOutputs.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Process/InAndOutputs.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -21,7 +21,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-import types,re, base64
+import types,re, base64,logging
 try:
     import magic
 except:

Modified: trunk/pywps/Soap.py
===================================================================
--- trunk/pywps/Soap.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Soap.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -83,7 +83,7 @@
     def getResponse(self,document):
         """Wrap document into soap envelope"""
         # very primitive, but works
-        document = document.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>","")
+        document = document.__str__().replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>","")
         return SOAP_ENVELOPE.replace("$SOAPBODY$",document)
 
 

Modified: trunk/pywps/Wps/Execute.py
===================================================================
--- trunk/pywps/Wps/Execute.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/Wps/Execute.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -934,6 +934,9 @@
                         if not output.projection:
                             from osgeo import gdal
                             dataset = gdal.Open(output.value)
+                            if not dataset:
+                                from osgeo import ogr
+                                dataset = ogr.Open(output.value)
                             output.projection = dataset.GetProjection()
                         if not output.projection:
                             output.projection = self.mapObj.getProjection()

Modified: trunk/pywps/response.py
===================================================================
--- trunk/pywps/response.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/pywps/response.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -14,6 +14,7 @@
 import re
 from pywps import Exceptions
 from os import name as OSNAME
+from pywps import Soap 
 
 EMPTYPARAMREGEX = re.compile('( \w+="")|( \w+="None")')
 

Modified: trunk/tests/perform_requests.py
===================================================================
--- trunk/tests/perform_requests.py	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/tests/perform_requests.py	2010-06-11 06:51:06 UTC (rev 952)
@@ -104,7 +104,7 @@
         """Test if Execute with LiteralInput and Output is executed"""
         getpywps = pywps.Pywps(pywps.METHOD_GET)
         postpywps = pywps.Pywps(pywps.METHOD_POST)
-        getinputs = getpywps.parseRequest("service=wps&version=1.0.0&request=execute&identifier=literalprocess&datainputs=[int=1;string=spam;float=1.1]")
+        getinputs = getpywps.parseRequest("service=wps&version=1.0.0&request=execute&identifier=literalprocess&datainputs=[int=1;string=spam;float=1.1;zeroset=0.0]")
         executeRequestFile = open(os.path.join(pywpsPath,"tests","requests","wps_execute_request-literalinput.xml"))
         postinputs = postpywps.parseRequest(executeRequestFile)
 

Modified: trunk/tests/requests/wps_execute_request-literalinput.xml
===================================================================
--- trunk/tests/requests/wps_execute_request-literalinput.xml	2010-05-11 14:10:26 UTC (rev 951)
+++ trunk/tests/requests/wps_execute_request-literalinput.xml	2010-06-11 06:51:06 UTC (rev 952)
@@ -28,5 +28,11 @@
                     <wps:LiteralData>1.1</wps:LiteralData>
                 </wps:Data>
             </wps:Input>
+            <wps:Input>
+                <ows:Identifier>zeroset</ows:Identifier>
+                <wps:Data>
+                    <wps:LiteralData>0</wps:LiteralData>
+                </wps:Data>
+            </wps:Input>
         </wps:DataInputs>
 </wps:Execute>



More information about the Pywps-commits mailing list