[GRASS-SVN] r54042 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 26 01:41:18 PST 2012


Author: zarch
Date: 2012-11-26 01:41:18 -0800 (Mon, 26 Nov 2012)
New Revision: 54042

Modified:
   grass/trunk/lib/python/pygrass/vector/table.py
Log:
Control column type before to try to add a new column

Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py	2012-11-26 09:18:07 UTC (rev 54041)
+++ grass/trunk/lib/python/pygrass/vector/table.py	2012-11-26 09:41:18 UTC (rev 54042)
@@ -322,6 +322,10 @@
 
         ..
         """
+        valid_type = ('DOUBLE PRECISION', 'INT', 'DATE')
+        if 'VARCHAR' in col_type or col_type.upper() not in valid_type:
+            str_err = "Type is not supported, supported types are: %s"
+            raise TypeError(str_err % ", ".join(valid_type))
         cur = self.conn.cursor()
         cur.execute(sql.ADD_COL.format(tname=self.tname,
                                        cname=col_name,



More information about the grass-commit mailing list