瀏覽代碼

v.report: fix when using vector map without db connection, part of the code was not used at all, see colnames variable (merge from trunk, https://trac.osgeo.org/grass/changeset/64134)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@64172 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 年之前
父節點
當前提交
90b84725d0
共有 1 個文件被更改,包括 6 次插入3 次删除
  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: