ソースを参照

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 年 前
コミット
a9a506248a
1 ファイル変更4 行追加2 行削除
  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)
     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.
     """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.
     It returns None if no vectors are connected to the table.
 
 
     >>> run_command('g.copy', vector='firestations,myfirestations')
     >>> run_command('g.copy', vector='firestations,myfirestations')
@@ -187,7 +189,7 @@ def db_table_in_vector(table):
     from .vector import vector_db
     from .vector import vector_db
     nuldev = file(os.devnull, 'w')
     nuldev = file(os.devnull, 'w')
     used = []
     used = []
-    vects = list_strings('vect')
+    vects = list_strings('vector', mapset=mapset)
     for vect in vects:
     for vect in vects:
         for f in vector_db(vect, stderr=nuldev).values():
         for f in vector_db(vect, stderr=nuldev).values():
             if not f:
             if not f: