[GRASS-SVN] r72740 - grass/trunk/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 26 03:50:55 PDT 2018


Author: lucadelu
Date: 2018-05-26 03:50:54 -0700 (Sat, 26 May 2018)
New Revision: 72740

Modified:
   grass/trunk/lib/python/script/db.py
Log:
db.py: added option in db_table_in_vector to check by default only vectors in current mapset. fixed #3536

Modified: grass/trunk/lib/python/script/db.py
===================================================================
--- grass/trunk/lib/python/script/db.py	2018-05-26 01:22:38 UTC (rev 72739)
+++ grass/trunk/lib/python/script/db.py	2018-05-26 10:50:54 UTC (rev 72740)
@@ -170,8 +170,10 @@
     return tuple(result)
 
 
-def db_table_in_vector(table):
+def db_table_in_vector(table, mapset='.'):
     """Return the name of vector connected to the table.
+    By default it check only in the current mapset, because the same table
+    name could be used also in other mapset by other vector.
     It returns None if no vectors are connected to the table.
 
     >>> run_command('g.copy', vector='firestations,myfirestations')
@@ -187,7 +189,7 @@
     from .vector import vector_db
     nuldev = file(os.devnull, 'w')
     used = []
-    vects = list_strings('vect')
+    vects = list_strings('vector', mapset=mapset)
     for vect in vects:
         for f in vector_db(vect, stderr=nuldev).values():
             if not f:



More information about the grass-commit mailing list