Ver código fonte

Unified error message when space time dataset is not found

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51248 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 13 anos atrás
pai
commit
bbc593d458

+ 1 - 1
temporal/t.info/t.info.py

@@ -84,7 +84,7 @@ def main():
     sp = tgis.dataset_factory(type, id)
 
     if sp.is_in_db() == False:
-        grass.fatal(_("Dataset <%s> not found in temporal database") % name)
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
         
     sp.select()
 

+ 2 - 11
temporal/t.remove/t.remove.py

@@ -105,21 +105,12 @@ def main():
 
         if sp.is_in_db(dbif) == False:
             dbif.close()
-            grass.fatal(_("%s dataset <%s> not found in temporal database") % (sp.get_type(), name))
+            grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
         statement += sp.delete(dbif=dbif, execute=False)
 
     # Execute the collected SQL statenents
-    sql_script = ""
-    sql_script += "BEGIN TRANSACTION;\n"
-    sql_script += statement
-    sql_script += "END TRANSACTION;"
-    # print sql_script
-
-    if tgis.dbmi.__name__ == "sqlite3":
-            dbif.cursor.executescript(statement)
-    else:
-            dbif.cursor.execute(statement)
+    tgis.execute_transaction(statement, dbif)
 
     dbif.close()
 

+ 2 - 1
temporal/t.support/t.support.py

@@ -89,7 +89,8 @@ def main():
     else:
         id = name + "@" + mapset
         
-    dbif, connect = tgis.init_dbif(None)
+    dbif = tgis.sql_database_interface()
+    dbif.connect()
 
     sp = tgis.dataset_factory(type, id)
 

+ 1 - 1
temporal/t.topology/t.topology.py

@@ -60,7 +60,7 @@ def main():
     sp = tgis.dataset_factory(type, id)
 
     if sp.is_in_db() == False:
-        grass.fatal("Dataset <" + name + "> not found in temporal database")
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
         
     # Insert content from db
     sp.select()

+ 2 - 1
temporal/t.unregister/t.unregister.py

@@ -63,7 +63,8 @@ def main():
 
     mapset =  grass.gisenv()["MAPSET"]
 
-    dbif, connect = tgis.init_dbif(None)
+    dbif = tgis.sql_database_interface()
+    dbif.connect()
 
     # In case a space time dataset is specified
     if name:

+ 1 - 1
temporal/tr.aggregate.ds/tr.aggregate.ds.py

@@ -95,7 +95,7 @@ def main():
     
     if sp.is_in_db() == False:
         dbif.close()
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select(dbif)
 

+ 1 - 1
temporal/tr.aggregate/tr.aggregate.py

@@ -108,7 +108,7 @@ def main():
     
     if sp.is_in_db() == False:
         dbif.close()
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select(dbif)
 

+ 1 - 1
temporal/tr.export/tr.export.py

@@ -88,7 +88,7 @@ def main():
     sp = tgis.space_time_raster_dataset(id)
     
     if sp.is_in_db() == False:
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     # Save current working directory path
     old_cwd = os.getcwd()

+ 1 - 1
temporal/tr.extract/tr.extract.py

@@ -84,7 +84,7 @@ def main():
     sp = tgis.space_time_raster_dataset(id)
     
     if sp.is_in_db() == False:
-        grass.fatal(_("Space time arster dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     if expression and not base:
         grass.fatal(_("Please specify base="))

+ 1 - 1
temporal/tr.mapcalc/tr.mapcalc.py

@@ -105,7 +105,7 @@ def main():
     
     if first_input.is_in_db(dbif) == False:
 	dbif.close()
-	grass.fatal(_("Space time raster dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     # Fill the object with data from the temporal database
     first_input.select(dbif)

+ 1 - 1
temporal/tr.out.vtk/tr.out.vtk.py

@@ -103,7 +103,7 @@ def main():
     sp = tgis.space_time_raster_dataset(id)
     
     if sp.is_in_db() == False:
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select()
 

+ 1 - 1
temporal/tr.series/tr.series.py

@@ -81,7 +81,7 @@ def main():
     sp = tgis.space_time_raster_dataset(id)
 
     if sp.is_in_db() == False:
-        grass.fatal(_("Space time raster dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select()
 

+ 1 - 1
temporal/tr.to.rast3/tr.to.rast3.py

@@ -52,7 +52,7 @@ def main():
     sp = tgis.space_time_raster_dataset(id)
 
     if sp.is_in_db() == False:
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select()
 

+ 1 - 1
temporal/tr.univar/tr.univar.py

@@ -76,7 +76,7 @@ def main():
     
     if sp.is_in_db(dbif) == False:
         dbif.close()
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select(dbif)
 

+ 1 - 1
temporal/tr3.extract/tr3.extract.py

@@ -81,7 +81,7 @@ def main():
     sp = tgis.space_time_raster3d_dataset(id)
     
     if sp.is_in_db() == False:
-        grass.fatal(_("Space time raster3d dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     dbif = tgis.sql_database_interface()
     dbif.connect()

+ 1 - 1
temporal/tv.observe.strds/tv.observe.strds.py

@@ -90,7 +90,7 @@ def main():
     
     if strds_sp.is_in_db() == False:
         dbif.close()
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     strds_sp.select(dbif)
 

+ 1 - 1
temporal/tv.what.strds/tv.what.strds.py

@@ -82,7 +82,7 @@ def main():
     
     if sp.is_in_db() == False:
         dbif.close()
-        grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
+        grass.fatal(_("Space time %s dataset <%s> not found") % (sp.get_new_map_instance(None).get_type(), id))
 
     sp.select(dbif)