[Pywps-commits] r1116 - trunk/pywps/Wps/Execute
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 8 15:30:16 CET 2011
Author: jesus
Date: 2011-02-08 15:30:16 +0100 (Tue, 08 Feb 2011)
New Revision: 1116
Modified:
trunk/pywps/Wps/Execute/__init__.py
Log:
xml.sax.saxutils.escape to parse any output URL to remove &,<,>, so that XML parses
Modified: trunk/pywps/Wps/Execute/__init__.py
===================================================================
--- trunk/pywps/Wps/Execute/__init__.py 2011-02-08 14:26:33 UTC (rev 1115)
+++ trunk/pywps/Wps/Execute/__init__.py 2011-02-08 14:30:16 UTC (rev 1116)
@@ -37,8 +37,13 @@
import logging
import UMN
+from xml.sax.saxutils import escape
+
TEMPDIRPREFIX="pywps-instance"
+#Note: saxutils to escape &,< and > from URLs. Applied to _lineageComplexRerenceInput,_asReferenceOutput. in the last case
+# it as been applied to ALL references, just as precausion
+
class Execute(Request):
"""
This class performs the Execute request of WPS specification and
@@ -273,6 +278,7 @@
"status is true, but storeExecuteResponse is false")
# HEAD
+
self.templateProcessor.set("encoding",
config.getConfigValue("wps","encoding"))
self.templateProcessor.set("lang",
@@ -775,7 +781,8 @@
:param wpsInput: associative field of self.wps.inputs["datainputs"]
:param processInput: self.process.inputs
"""
- complexInput["reference"] = wpsInput["value"]
+ #URLS need to be quoted otherwise XML is not valid
+ complexInput["reference"] = escape(wpsInput["value"])
method = "GET"
if wpsInput.has_key("method"):
method = wpsInput["method"]
@@ -985,7 +992,7 @@
f = open(tmp[1],"w")
f.write(str(output.value))
f.close()
- templateOutput["reference"] = tmp[1]
+ templateOutput["reference"] = escape(tmp[1])
# complex value
else:
outName = os.path.basename(output.value)
@@ -998,8 +1005,7 @@
if not self._samefile(output.value,outFile):
COPY(os.path.abspath(output.value), outFile)
- templateOutput["reference"] = \
- config.getConfigValue("server","outputUrl")+"/"+outName
+ templateOutput["reference"] = escape(config.getConfigValue("server","outputUrl")+"/"+outName)
output.value = outFile
# mapscript supported and the mapserver should be used for this
@@ -1012,12 +1018,13 @@
if self.umn and output.useMapscript:
owsreference = self.umn.getReference(output)
if owsreference:
- templateOutput["reference"] = owsreference
+ templateOutput["reference"] = escape(owsreference)
+
templateOutput["mimeType"] = output.format["mimetype"]
templateOutput["schema"] = output.format["schema"]
templateOutput["encoding"]=output.format["encoding"]
-
+
return templateOutput
def _samefile(self, src, dst):
More information about the Pywps-commits
mailing list