Selaa lähdekoodia

db.py: added option in db_table_in_vector to check by default only vectors in current mapset. fixed https://trac.osgeo.org/grass/ticket/3536

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72740 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 7 vuotta sitten
vanhempi
commit
a9a506248a
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      lib/python/script/db.py

+ 4 - 2
lib/python/script/db.py

@@ -170,8 +170,10 @@ def db_select(sql=None, filename=None, table=None, **args):
     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 @@ def db_table_in_vector(table):
     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: