[GRASS-SVN] r71426 - in grass/branches/releasebranch_7_2: lib/python/temporal temporal/t.info temporal/t.merge temporal/t.rast.gapfill temporal/t.rast.series temporal/t.rast.to.rast3 temporal/t.rename temporal/t.unregister temporal/t.vect.observe.strds
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 21 10:13:21 PDT 2017
Author: mlennert
Date: 2017-08-21 10:13:21 -0700 (Mon, 21 Aug 2017)
New Revision: 71426
Modified:
grass/branches/releasebranch_7_2/lib/python/temporal/core.py
grass/branches/releasebranch_7_2/temporal/t.info/t.info.py
grass/branches/releasebranch_7_2/temporal/t.merge/t.merge.py
grass/branches/releasebranch_7_2/temporal/t.rast.gapfill/t.rast.gapfill.py
grass/branches/releasebranch_7_2/temporal/t.rast.series/t.rast.series.py
grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.py
grass/branches/releasebranch_7_2/temporal/t.rename/t.rename.py
grass/branches/releasebranch_7_2/temporal/t.unregister/t.unregister.py
grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.py
Log:
temporal lib: use str not unicode and encode variables resulting from gisenv() (backport from trunk, r71411, r71422, r71423, see #3392)
Modified: grass/branches/releasebranch_7_2/lib/python/temporal/core.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/core.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/core.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -543,9 +543,9 @@
grassenv = gscript.gisenv()
# Set the global variable for faster access
- current_mapset = grassenv["MAPSET"]
- current_location = grassenv["LOCATION_NAME"]
- current_gisdbase = grassenv["GISDBASE"]
+ current_mapset = gscript.encode(grassenv["MAPSET"])
+ current_location = gscript.encode(grassenv["LOCATION_NAME"])
+ current_gisdbase = gscript.encode(grassenv["GISDBASE"])
# Check environment variable GRASS_TGIS_RAISE_ON_ERROR
if os.getenv("GRASS_TGIS_RAISE_ON_ERROR") == "True" or \
@@ -571,14 +571,14 @@
# Set the mapset check and the timestamp write
if "TGIS_DISABLE_MAPSET_CHECK" in grassenv:
- if grassenv["TGIS_DISABLE_MAPSET_CHECK"] == "True" or \
- grassenv["TGIS_DISABLE_MAPSET_CHECK"] == "1":
+ if gscript.encode(grassenv["TGIS_DISABLE_MAPSET_CHECK"]) == "True" or \
+ gscript.encode(grassenv["TGIS_DISABLE_MAPSET_CHECK"]) == "1":
enable_mapset_check = False
msgr.warning("TGIS_DISABLE_MAPSET_CHECK is True")
if "TGIS_DISABLE_TIMESTAMP_WRITE" in grassenv:
- if grassenv["TGIS_DISABLE_TIMESTAMP_WRITE"] == "True" or \
- grassenv["TGIS_DISABLE_TIMESTAMP_WRITE"] == "1":
+ if gscript.encode(grassenv["TGIS_DISABLE_TIMESTAMP_WRITE"]) == "True" or \
+ gscript.encode(grassenv["TGIS_DISABLE_TIMESTAMP_WRITE"]) == "1":
enable_timestamp_write = False
msgr.warning("TGIS_DISABLE_TIMESTAMP_WRITE is True")
@@ -1108,6 +1108,7 @@
detect_types=self.dbmi.PARSE_DECLTYPES | self.dbmi.PARSE_COLNAMES)
self.connection.row_factory = self.dbmi.Row
self.connection.isolation_level = None
+ self.connection.text_factory = str
self.cursor = self.connection.cursor()
self.cursor.execute("PRAGMA synchronous = OFF")
self.cursor.execute("PRAGMA journal_mode = MEMORY")
Modified: grass/branches/releasebranch_7_2/temporal/t.info/t.info.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.info/t.info.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.info/t.info.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -99,7 +99,7 @@
if name.find("@") >= 0:
id_ = name
else:
- id_ = name + "@" + grass.gisenv()["MAPSET"]
+ id_ = name + "@" + grass.encode(grass.gisenv()["MAPSET"])
dataset = tgis.dataset_factory(type_, id_)
Modified: grass/branches/releasebranch_7_2/temporal/t.merge/t.merge.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.merge/t.merge.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.merge/t.merge.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -52,7 +52,7 @@
tgis.init()
#Get the current mapset to create the id of the space time dataset
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
inputs_split = inputs.split(",")
input_ids = []
Modified: grass/branches/releasebranch_7_2/temporal/t.rast.gapfill/t.rast.gapfill.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.gapfill/t.rast.gapfill.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.gapfill/t.rast.gapfill.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -82,7 +82,7 @@
nprocs = options["nprocs"]
tsuffix = options["suffix"]
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
# Make sure the temporal database exists
tgis.init()
Modified: grass/branches/releasebranch_7_2/temporal/t.rast.series/t.rast.series.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.series/t.rast.series.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.series/t.rast.series.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -120,7 +120,7 @@
if output.find("@") >= 0:
id = output
else:
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
id = output + "@" + mapset
map = sp.get_new_map_instance(id)
Modified: grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -50,7 +50,7 @@
# Make sure the temporal database exists
tgis.init()
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
sp = tgis.open_old_stds(input, "strds")
Modified: grass/branches/releasebranch_7_2/temporal/t.rename/t.rename.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.rename/t.rename.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.rename/t.rename.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -51,7 +51,7 @@
tgis.init()
#Get the current mapset to create the id of the space time dataset
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
if input.find("@") >= 0:
old_id = input
Modified: grass/branches/releasebranch_7_2/temporal/t.unregister/t.unregister.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.unregister/t.unregister.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.unregister/t.unregister.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -67,7 +67,7 @@
if not maps and not file:
grass.fatal(_("%s= or %s= must be specified") % ("input", "file"))
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
dbif = tgis.SQLDatabaseInterfaceConnection()
dbif.connect()
Modified: grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.py
===================================================================
--- grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.py 2017-08-21 17:01:03 UTC (rev 71425)
+++ grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.py 2017-08-21 17:13:21 UTC (rev 71426)
@@ -98,7 +98,7 @@
dbif = tgis.SQLDatabaseInterfaceConnection()
dbif.connect()
- mapset = grass.gisenv()["MAPSET"]
+ mapset = grass.encode(grass.gisenv()["MAPSET"])
out_sp = tgis.check_new_stds(output, "stvds", dbif, overwrite)
More information about the grass-commit
mailing list