[GRASS-SVN] r58652 - in grass/trunk: lib/python/temporal temporal/t.info
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 9 12:34:13 PST 2014
Author: huhabla
Date: 2014-01-09 12:34:13 -0800 (Thu, 09 Jan 2014)
New Revision: 58652
Modified:
grass/trunk/lib/python/temporal/core.py
grass/trunk/temporal/t.info/t.info.py
Log:
Give more information in case the temporal database is incompatible.
GRASS_TGIS_RAISE_ON_ERROR environmental variable introduced.
Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py 2014-01-09 02:10:13 UTC (rev 58651)
+++ grass/trunk/lib/python/temporal/core.py 2014-01-09 20:34:13 UTC (rev 58652)
@@ -357,7 +357,6 @@
- MAPSET
- LOCATION_NAME
- GISDBASE
- - TGIS_RAISE_ON_ERROR
- TGIS_DISABLE_MAPSET_CHECK
- TGIS_DISABLE_TIMESTAMP_WRITE
@@ -367,6 +366,7 @@
The following environmental variables are checked:
- GRASS_TGIS_PROFILE
+ - GRASS_TGIS_RAISE_ON_ERROR
ATTENTION: This functions must be called before any spatio-temporal processing
can be started
@@ -395,10 +395,9 @@
current_location = grassenv["LOCATION_NAME"]
current_gisdbase = grassenv["GISDBASE"]
- # Check the g.gisenv variable TGIS_RAISE_ON_ERROR
- if grassenv.has_key("TGIS_RAISE_ON_ERROR"):
- if grassenv["TGIS_RAISE_ON_ERROR"] == "True" or grassenv["TGIS_RAISE_ON_ERROR"] == "1":
- raise_on_error = True
+ # Check environment variable GRASS_TGIS_RAISE_ON_ERROR
+ if os.getenv("GRASS_TGIS_RAISE_ON_ERROR") is not None:
+ raise_on_error = True
# Start the GRASS message interface server
_init_tgis_message_interface(raise_on_error)
@@ -407,9 +406,6 @@
msgr = get_tgis_message_interface()
msgr.debug(1, "Inititate the temporal database")
- if raise_on_error is True:
- msgr.warning("TGIS_RAISE_ON_ERROR is True")
-
# Set the mapset check and the timestamp write
if grassenv.has_key("TGIS_DISABLE_MAPSET_CHECK"):
if grassenv["TGIS_DISABLE_MAPSET_CHECK"] == "True" or grassenv["TGIS_DISABLE_MAPSET_CHECK"] == "1":
@@ -491,27 +487,44 @@
if db_exists == True:
# Check the version of the temporal database
- # This version works only with database of version 2
dbif.close()
dbif.connect()
metadata = get_tgis_metadata(dbif)
dbif.close()
if metadata is None:
- msgr.fatal(_("Unable to receiving temporal database metadata. Your temporal database is not supported."))
-
+ msgr.fatal(_("Unable to receiving temporal database metadata.\n"
+ "Your temporal database is not supported.\n"
+ "Please remove your temporal database. A new one will be cerated automatically.\n"
+ "Current temporal database info:%(info)s")%({"info":get_database_info_string()}))
for entry in metadata:
if "tgis_version" in entry and entry[1] != str(get_tgis_version()):
msgr.fatal(_("Unsupported temporal database. Version mismatch.\n"
- "Supported temporal API version is: %(api)i")%({"api":get_tgis_version()}))
+ "Supported temporal API version is: %(api)i.\n"
+ "Please update your GRASS installation to the latest svn version.\n"
+ "Current temporal database info:%(info)s")%({"api":get_tgis_version(),
+ "info":get_database_info_string()}))
if "tgis_db_version" in entry and entry[1] != str(get_tgis_db_version()):
msgr.fatal(_("Unsupported temporal database. Version mismatch.\n"
- "Supported temporal database version is: %(tdb)i")%( {"tdb":get_tgis_db_version()}))
+ "Supported temporal database version is: %(tdb)i\n"
+ "Please remove your old temporal database. \n"
+ "A new one will be created automatically.\n"
+ "Current temporal database info:%(info)s")%({"tdb":get_tgis_version(),
+ "info":get_database_info_string()}))
return
create_temporal_database(dbif)
###############################################################################
+def get_database_info_string():
+ dbif = SQLDatabaseInterfaceConnection()
+
+ info = "\nDBMI interface:..... " + str(dbif.dbmi.__name__)
+ info += "\nTemporal database:.. " + str( get_tgis_database_string())
+ return info
+
+###############################################################################
+
def create_temporal_database(dbif):
"""!This function will create the temporal database
Modified: grass/trunk/temporal/t.info/t.info.py
===================================================================
--- grass/trunk/temporal/t.info/t.info.py 2014-01-09 02:10:13 UTC (rev 58651)
+++ grass/trunk/temporal/t.info/t.info.py 2014-01-09 20:34:13 UTC (rev 58652)
@@ -89,7 +89,7 @@
return
elif system:
print "dbmi_python_interface=\'" + str(dbif.dbmi.__name__) + "\'"
- print "dbmi_init_string=\'" + str(tgis.get_tgis_database_string()) + "\'"
+ print "dbmi_string=\'" + str(tgis.get_tgis_database_string()) + "\'"
print "sql_template_path=\'" + str(tgis.get_sql_template_path()) + "\'"
if rows:
for row in rows:
More information about the grass-commit
mailing list