Преглед изворни кода

temporal lib: add error message if the are no maps in the request, see https://trac.osgeo.org/grass/ticket/2268

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73440 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi пре 6 година
родитељ
комит
e9c01d6cf0
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      lib/python/temporal/list_stds.py

+ 10 - 0
lib/python/temporal/list_stds.py

@@ -25,6 +25,7 @@ from .datetime_math import time_delta_to_relative_time
 from .space_time_datasets import RasterDataset
 from .space_time_datasets import RasterDataset
 from .factory import dataset_factory
 from .factory import dataset_factory
 from .open_stds import open_old_stds
 from .open_stds import open_old_stds
+import grass.script as gscript
 
 
 ###############################################################################
 ###############################################################################
 
 
@@ -254,6 +255,15 @@ def list_maps_of_stds(type, input, columns, order, where, separator,
                 columns = "id"
                 columns = "id"
 
 
         rows = sp.get_registered_maps(columns, where, order, dbif)
         rows = sp.get_registered_maps(columns, where, order, dbif)
+        
+        if not rows:
+            dbif.close()
+            err = "Space time %(sp)s dataset <%(i)s> is empty"
+            if where:
+                err += " or where condition is wrong"
+            gscript.fatal(_(err) % {
+                            'sp': sp.get_new_map_instance(None).get_type(),
+                            'i': sp.get_id()})
 
 
         if rows:
         if rows:
             if method == "comma":
             if method == "comma":