[GRASS-SVN] r51893 - grass/trunk/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 30 09:49:58 PDT 2012


Author: huhabla
Date: 2012-05-30 09:49:57 -0700 (Wed, 30 May 2012)
New Revision: 51893

Modified:
   grass/trunk/lib/python/temporal/datetime_math.py
   grass/trunk/lib/python/temporal/space_time_datasets_tools.py
Log:
Better increment format check


Modified: grass/trunk/lib/python/temporal/datetime_math.py
===================================================================
--- grass/trunk/lib/python/temporal/datetime_math.py	2012-05-30 15:54:44 UTC (rev 51892)
+++ grass/trunk/lib/python/temporal/datetime_math.py	2012-05-30 16:49:57 UTC (rev 51893)
@@ -79,8 +79,12 @@
         incparts = increment.split(",")
         for incpart in incparts:
             inclist.append(incpart.strip().split(" "))
+            
 
         for inc in inclist:
+	    if len(inc) < 2:
+		core.error(_("Wrong increment format: %s") % (increment))
+		return None
             if inc[1].find("seconds") >= 0:
                 seconds = mult * int(inc[0])
             elif inc[1].find("minutes") >= 0:

Modified: grass/trunk/lib/python/temporal/space_time_datasets_tools.py
===================================================================
--- grass/trunk/lib/python/temporal/space_time_datasets_tools.py	2012-05-30 15:54:44 UTC (rev 51892)
+++ grass/trunk/lib/python/temporal/space_time_datasets_tools.py	2012-05-30 16:49:57 UTC (rev 51893)
@@ -295,8 +295,12 @@
         # Add the increment
         if increment:
             start_time = increment_datetime_by_string(start_time, increment, mult)
+            if start_time == None:
+		core.fatal(_("Error in increment computation"))
             if interval:
                 end_time = increment_datetime_by_string(start_time, increment, 1)
+		if end_time == None:
+		    core.fatal(_("Error in increment computation"))
 	if map.get_layer():
 	    core.verbose(_("Set absolute valid time for map <%s> with layer %s to %s - %s") % (map.get_map_id(), map.get_layer(), str(start_time), str(end_time)))
         else:



More information about the grass-commit mailing list