[GRASS-SVN] r64134 - grass/trunk/scripts/v.report

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 13 08:42:34 PST 2015


Author: annakrat
Date: 2015-01-13 08:42:34 -0800 (Tue, 13 Jan 2015)
New Revision: 64134

Modified:
   grass/trunk/scripts/v.report/v.report.py
Log:
v.report: fix when using vector map without db connection, part of the code was not used at all, see colnames variable

Modified: grass/trunk/scripts/v.report/v.report.py
===================================================================
--- grass/trunk/scripts/v.report/v.report.py	2015-01-13 15:04:10 UTC (rev 64133)
+++ grass/trunk/scripts/v.report/v.report.py	2015-01-13 16:42:34 UTC (rev 64134)
@@ -67,8 +67,11 @@
     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 @@
         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:



More information about the grass-commit mailing list