[GRASS-SVN] r66663 - grass/trunk/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 29 09:44:10 PDT 2015
Author: zarch
Date: 2015-10-29 09:44:10 -0700 (Thu, 29 Oct 2015)
New Revision: 66663
Modified:
grass/trunk/lib/python/pygrass/vector/abstract.py
Log:
pygrass: Create a link/table also when open a vector map in rw mode
Modified: grass/trunk/lib/python/pygrass/vector/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/abstract.py 2015-10-29 15:52:52 UTC (rev 66662)
+++ grass/trunk/lib/python/pygrass/vector/abstract.py 2015-10-29 16:44:10 UTC (rev 66663)
@@ -352,19 +352,20 @@
if mode == 'w':
openvect = libvect.Vect_open_new(self.c_mapinfo, self.name, with_z)
self.dblinks = DBlinks(self.c_mapinfo)
- if tab_cols:
- # create a link
- link = Link(layer,
- link_name if link_name else self.name,
- tab_name if tab_name else self.name,
- link_key, link_db, link_driver)
- # add the new link
- self.dblinks.add(link)
- # create the table
- table = link.table()
- table.create(tab_cols)
- table.conn.commit()
+ if mode in ('w', 'rw') and tab_cols:
+ # create a link
+ link = Link(layer,
+ link_name if link_name else self.name,
+ tab_name if tab_name else self.name,
+ link_key, link_db, link_driver)
+ # add the new link
+ self.dblinks.add(link)
+ # create the table
+ table = link.table()
+ table.create(tab_cols)
+ table.conn.commit()
+
# check the C function result.
if openvect == -1:
str_err = "Not able to open the map, C function return %d."
More information about the grass-commit
mailing list