[GRASS-SVN] r58927 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 7 00:06:57 PST 2014
Author: huhabla
Date: 2014-02-07 00:06:56 -0800 (Fri, 07 Feb 2014)
New Revision: 58927
Modified:
grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
Log:
Check for matching mapsets updated
Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2014-02-07 08:01:06 UTC (rev 58926)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2014-02-07 08:06:56 UTC (rev 58927)
@@ -1866,13 +1866,13 @@
statement = self.update(dbif, execute=False, ident=old_ident)
# We need to rename the raster register table
- statement += "ALTER TABLE %s RENAME TO \"%s\";\n" % (old_map_register_table,
+ statement += "ALTER TABLE %s RENAME TO \"%s\";\n" % (old_map_register_table,
new_map_register_table)
# We need to take care of the stds index in the sqlite3 database
if dbif.dbmi.__name__ == "sqlite3":
statement += "DROP INDEX %s_index;\n" % (old_map_register_table)
- statement += "CREATE INDEX %s_index ON %s (id);"%(new_map_register_table,
+ statement += "CREATE INDEX %s_index ON %s (id);"%(new_map_register_table,
new_map_register_table)
# We need to rename the space time dataset in the maps register table
@@ -1953,17 +1953,17 @@
def is_map_registered(self, map_id, dbif=None):
"""!Check if a map is registered in the space time dataset
-
+
@param map_id The map id
@param dbif The database interface to be used
@return True if success, False otherwise
"""
stds_register_table = self.get_map_register()
-
+
dbif, connected = init_dbif(dbif)
-
+
is_registered = False
-
+
# Check if map is already registered
if stds_register_table is not None:
if dbif.dbmi.paramstyle == "qmark":
@@ -1978,15 +1978,15 @@
except:
self.msgr.warning(_("Error in register table request"))
raise
-
+
if row is not None and row[0] == map_id:
is_registered = True
-
+
if connected == True:
dbif.close()
return is_registered
-
+
def register_map(self, map, dbif=None):
"""!Register a map in the space time dataset.
@@ -2091,7 +2091,7 @@
"<%(id)s> and map <%(map)s> are different") % \
{'id': self.get_id(), 'map': map.get_map_id()})
- if stds_mapset != map_mapset:
+ if get_enable_mapset_check() is True and stds_mapset != map_mapset:
dbif.close()
self.msgr.fatal(_("Only maps from the same mapset can be registered"))
@@ -2107,9 +2107,9 @@
return False
# Register the stds in the map stds register table column
- statement += map.add_dataset_to_register(stds_id=self.base.get_id(),
+ statement += map.add_dataset_to_register(stds_id=self.base.get_id(),
dbif=dbif, execute=False)
-
+
# Now put the raster name in the stds map register table
if dbif.dbmi.paramstyle == "qmark":
sql = "INSERT INTO " + stds_register_table + \
@@ -2117,8 +2117,8 @@
else:
sql = "INSERT INTO " + stds_register_table + \
" (id) " + "VALUES (%s);\n"
-
+
statement += dbif.mogrify_sql_statement((sql, (map_id,)))
# Now execute the insert transaction
@@ -2176,9 +2176,9 @@
# Remove the space time dataset from the dataset register
# We need to execute the statement here, otherwise the space time dataset will not be
# removed correctly
- map.remove_dataset_from_register(self.base.get_id(),
+ map.remove_dataset_from_register(self.base.get_id(),
dbif=dbif, execute=True)
-
+
# Remove the map from the space time dataset register
stds_register_table = self.get_map_register()
if stds_register_table is not None:
@@ -2392,7 +2392,7 @@
self.temporal_extent.set_map_time(None)
self.temporal_extent.set_granularity(None)
self.temporal_extent.update_all(dbif)
-
+
# Set the modification time
self.base.set_mtime(datetime.now())
self.base.update(dbif)
More information about the grass-commit
mailing list