You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/12/14 14:41:23 UTC

svn commit: r487206 - /incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py

Author: robbinspg
Date: Thu Dec 14 05:41:23 2006
New Revision: 487206

URL: http://svn.apache.org/viewvc?view=rev&rev=487206
Log:
Handle null values returned from the webservice

Modified:
    incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py

Modified: incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py?view=diff&rev=487206&r1=487205&r2=487206
==============================================================================
--- incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py (original)
+++ incubator/tuscany/cpp/sca/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py Thu Dec 14 05:41:23 2006
@@ -58,8 +58,8 @@
         result += "Latitude: "+ weather.findtext(pathAndNS+"Latitude")+ " Longitude: "+ weather.findtext(pathAndNS+"Longitude")+"\n\n"
     
         for node in weather.findall(".//{http://www.webservicex.net}WeatherData"):
-            result += node.findtext(pathAndNS+"Day")
-            result += ":\tMax "+ node.findtext(pathAndNS+"MaxTemperatureC")
-            result += "C. Min "+ node.findtext(pathAndNS+"MinTemperatureC")+ "C.\n"
+            if node.findtext(pathAndNS+"Day"): result += node.findtext(pathAndNS+"Day")
+            if node.findtext(pathAndNS+"MaxTemperatureC"): result += ":\tMax "+ node.findtext(pathAndNS+"MaxTemperatureC")
+            if node.findtext(pathAndNS+"MinTemperatureC"): result += "C. Min "+ node.findtext(pathAndNS+"MinTemperatureC")+ "C.\n"
 
     return result



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org