[Pywps-commits] r1127 - in branches/pywps-3.2-soap: pywps/Process tests/processes

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 9 17:13:35 CET 2011


Author: jesus
Date: 2011-02-09 17:13:34 +0100 (Wed, 09 Feb 2011)
New Revision: 1127

Modified:
   branches/pywps-3.2-soap/pywps/Process/__init__.py
   branches/pywps-3.2-soap/tests/processes/ultimatequestionprocess.py
Log:
percentageCompleted is always outputed as int (otherwise XML doesnt parse)

Modified: branches/pywps-3.2-soap/pywps/Process/__init__.py
===================================================================
--- branches/pywps-3.2-soap/pywps/Process/__init__.py	2011-02-09 16:12:55 UTC (rev 1126)
+++ branches/pywps-3.2-soap/pywps/Process/__init__.py	2011-02-09 16:13:34 UTC (rev 1127)
@@ -64,16 +64,19 @@
 
         :param msg: message for the client
         :type msg: string
-        :param percentDone: percent > 0
-        :type percentDone: float
+        :param percentDone: percent > 0 [0-99]
+        :type percentDone: int
         :param propagate: call onStatusChanged method
         :type propagate: boolean
         """
         self.code = "processstarted"
-        if (type(percentDone) == types.StringType):
-            self.percentCompleted += int(percentDone)
-        else:
-            self.percentCompleted = percentDone
+        #percentageDone has to be int. The trick below will cast str-->float-->int
+        
+        self.percentCompleted=int(float(percentDone))
+        #if (type(percentDone) == types.StringType):
+        #    self.percentCompleted += int(percentDone)
+        #else:
+        #    self.percentCompleted = percentDone
 
         if not msg:
             msg = "True"

Modified: branches/pywps-3.2-soap/tests/processes/ultimatequestionprocess.py
===================================================================
--- branches/pywps-3.2-soap/tests/processes/ultimatequestionprocess.py	2011-02-09 16:12:55 UTC (rev 1126)
+++ branches/pywps-3.2-soap/tests/processes/ultimatequestionprocess.py	2011-02-09 16:13:34 UTC (rev 1127)
@@ -8,7 +8,7 @@
 &status=true
 &storeExecuteResponse=true
 
-Done by Jorge de Jesus (jorge.de-jesus at jrc.it) as suggested by Kor de Jong
+Done by Jorge de Jesus (jmdj at pml.ac.uk) as suggested by Kor de Jong
 
 """
 
@@ -34,7 +34,7 @@
          self.status.set("Preparing....", 0)
          for i in xrange(1, 11):
              time.sleep(10)
-             self.status.set("Thinking.....", float(i*10)) 
+             self.status.set("Thinking.....", i*10) 
          #The final answer    
          self.Answer.setValue("42")
         



More information about the Pywps-commits mailing list