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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 16 02:59:59 PDT 2015


Author: zarch
Date: 2015-04-16 02:59:59 -0700 (Thu, 16 Apr 2015)
New Revision: 65076

Modified:
   grass/trunk/lib/python/pygrass/vector/table.py
Log:
pygrass: Add VARCHAR column support on Table

Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py	2015-04-16 09:30:37 UTC (rev 65075)
+++ grass/trunk/lib/python/pygrass/vector/table.py	2015-04-16 09:59:59 UTC (rev 65076)
@@ -405,8 +405,10 @@
             :type col_type: str
             """
             valid_type = ('DOUBLE PRECISION', 'DOUBLE', 'INT', 'INTEGER',
-                          'DATE')
-            if 'VARCHAR' in col_type or col_type.upper() not in valid_type:
+                          'DATE', 'VARCHAR')
+            col = col_type.upper()
+            valid = [col.startswith(tp) for tp in valid_type]
+            if not any(valid):
                 str_err = ("Type: %r is not supported."
                            "\nSupported types are: %s")
                 raise TypeError(str_err % (col_type, ", ".join(valid_type)))



More information about the grass-commit mailing list