Browse Source

v.report: fix when using vector map without db connection, part of the code was not used at all, see colnames variable

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64134 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 năm trước cách đây
mục cha
commit
a1f69656b4
1 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 6 3
      scripts/v.report/v.report.py

+ 6 - 3
scripts/v.report/v.report.py

@@ -67,8 +67,11 @@ def main():
     if not grass.find_file(mapname, 'vector')['file']:
         grass.fatal(_("Vector map <%s> not found") % mapname)
 
-    colnames = grass.vector_columns(mapname, layer, getDict = False, stderr = nuldev)
-    if not colnames:
+    if int(layer) in grass.vector_db(mapname):
+        colnames = grass.vector_columns(mapname, layer, getDict=False, stderr=nuldev)
+        isConnection = True
+    else:
+        isConnection = False
         colnames = ['cat']
 
     if option == 'coor':
@@ -86,7 +89,7 @@ def main():
         unitsp = None
 
     # NOTE: we suppress -1 cat and 0 cat
-    if colnames:
+    if isConnection:
         p = grass.pipe_command('v.db.select', quiet = True, flags='c', map = mapname, layer = layer)
         records1 = []
         for line in p.stdout: