[GRASS-SVN] r58743 - grass/trunk/gui/wxpython/iclass

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 19 01:11:12 PST 2014


Author: martinl
Date: 2014-01-19 01:11:12 -0800 (Sun, 19 Jan 2014)
New Revision: 58743

Modified:
   grass/trunk/gui/wxpython/iclass/frame.py
Log:
wxGUI/iclass: fix r58739

Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2014-01-18 23:11:50 UTC (rev 58742)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2014-01-19 09:11:12 UTC (rev 58743)
@@ -21,6 +21,7 @@
 import sys
 import copy
 import tempfile
+import types
 from core.utils import _
 
 if __name__ == "__main__":
@@ -742,7 +743,7 @@
             wx.EndBusyCursor()
             return False
         
-        dbFile = tempfile.NamedTemporaryFile(mode = 'w+b')
+        dbFile = tempfile.NamedTemporaryFile(mode = 'w')
         if dbInfo['driver'] != 'dbf':
             dbFile.write("BEGIN\n")
         # populate table
@@ -764,8 +765,9 @@
                 
         if dbInfo['driver'] != 'dbf':
             dbFile.write("COMMIT\n")
-
-        if 0 != RunCommand('db.execute', input=dbFile.name):
+        dbFile.file.flush()
+        
+        if 0 != RunCommand('db.execute', input=dbFile.name, driver=dbInfo['driver'], database=dbInfo['database']):
             wx.EndBusyCursor()
             return False
 
@@ -781,8 +783,12 @@
         @param value new value
         @param cat which category to update
         """
-        tmpFile.write("UPDATE %s SET %s = %s WHERE cat = %d\n" %
-                      (table, column, value, cat))
+        if type(value) == (types.IntType, types.FloatType):
+            tmpFile.write("UPDATE %s SET %s = %d WHERE cat = %d\n" %
+                          (table, column, value, cat))
+        else:
+            tmpFile.write("UPDATE %s SET %s = '%s' WHERE cat = %d\n" %
+                          (table, column, value, cat))
         
     def OnCategoryManager(self, event):
         """!Show category management dialog"""



More information about the grass-commit mailing list