[GRASS-SVN] r66015 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 25 06:41:44 PDT 2015
Author: huhabla
Date: 2015-08-25 06:41:44 -0700 (Tue, 25 Aug 2015)
New Revision: 66015
Modified:
grass/trunk/lib/python/temporal/core.py
Log:
temporal framework: Better error message in case the mapset is not accessable
Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py 2015-08-25 10:13:30 UTC (rev 66014)
+++ grass/trunk/lib/python/temporal/core.py 2015-08-25 13:41:44 UTC (rev 66015)
@@ -924,9 +924,8 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to mogrify sql statement. There is no "
- "temporal database connection defined for "
- "mapset <%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to mogrify sql statement. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].mogrify_sql_statement(content)
@@ -947,9 +946,8 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to check table. There is no temporal "
- "database connection defined for mapset "
- "<%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to check table. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].check_table(table_name)
@@ -964,9 +962,8 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to execute sql statement. There is no "
- "temporal database connection defined for "
- "mapset <%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to execute sql statement. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].execute(statement, args)
@@ -975,9 +972,8 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to fetch one. There is no temporal "
- "database connection defined for mapset "
- "<%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to fetch one. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].fetchone()
@@ -986,9 +982,8 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to fetch all. There is no temporal "
- "database connection defined for mapset "
- "<%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to fetch all. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].fetchall()
@@ -1004,12 +999,20 @@
mapset = self.current_mapset
if mapset not in self.tgis_mapsets.keys():
- self.msgr.fatal(_("Unable to execute transaction. There is no "
- "temporal database connection defined for "
- "mapset <%(mapset)s>" % {"mapset": mapset}))
+ self.msgr.fatal(_("Unable to execute transaction. " +
+ self._create_mapset_error_message(mapset)))
return self.connections[mapset].execute_transaction(statement)
+ def _create_mapset_error_message(self, mapset):
+
+ return("You have no permission to "
+ "access mapset <%(mapset)s>, or "
+ "mapset <%(mapset)s> has no temporal database. "
+ "Accessable mapsets are: <%(mapsets)s>" % \
+ {"mapset": mapset,
+ "mapsets":','.join(self.tgis_mapsets.keys())})
+
###############################################################################
More information about the grass-commit
mailing list