[GRASS-SVN] r62378 - in grass/branches/releasebranch_7_0: . gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 24 15:48:44 PDT 2014


Author: annakrat
Date: 2014-10-24 15:48:44 -0700 (Fri, 24 Oct 2014)
New Revision: 62378

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py
   grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/dialogs.py
   grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/vinfo.py
Log:
wxGUI/dbmgr: attempt to fix unicode errors from #1681 (merge from trunk, r61897)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:61095,61788,62141,62346,62352,62354,62356,62364
   + /grass/trunk:61095,61788,61897,62141,62346,62352,62354,62356,62364

Modified: grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py	2014-10-24 15:04:17 UTC (rev 62377)
+++ grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py	2014-10-24 22:48:44 UTC (rev 62378)
@@ -854,7 +854,7 @@
                 if enc:
                     sqlFile.write(sql.encode(enc) + ';')
                 else:
-                    sqlFile.write(sql + ';')
+                    sqlFile.write(sql.encode('utf-8') + ';')
                 sqlFile.write(os.linesep)
             sqlFile.close()
 
@@ -1440,14 +1440,13 @@
                     try:
                         if tlist.columns[columnName[i]]['ctype'] == int:
                             # values[i] is stored as text. 
-                            value = float(values[i])
-                        else:
-                            value = values[i]
-                        values[i] = tlist.columns[columnName[i]]['ctype'] (value)
+                            values[i] = int(float(values[i]))
+                        elif tlist.columns[columnName[i]]['ctype'] == float:
+                            values[i] = float(values[i])
                     except:
-                        raise ValueError(_("Value '%(value)s' needs to be entered as %(type)s.") % 
-                                         {'value' : str(values[i]),
-                                          'type' : tlist.columns[columnName[i]]['type']})
+                        raise ValueError(_("Value '%(value)s' needs to be entered as %(type)s.") %
+                                         {'value': values[i],
+                                          'type': tlist.columns[columnName[i]]['type']})
                     columnsString += '%s,' % columnName[i]
                     
                     if tlist.columns[columnName[i]]['ctype'] == str:

Modified: grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/dialogs.py	2014-10-24 15:04:17 UTC (rev 62377)
+++ grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/dialogs.py	2014-10-24 22:48:44 UTC (rev 62378)
@@ -242,7 +242,7 @@
                             if ctype != str:
                                 updatedValues.append(str(newvalue))
                             else:
-                                updatedValues.append("'" + str(newvalue) + "'")
+                                updatedValues.append("'" + newvalue + "'")
                         columns[name]['values'][idx] = newvalue
 
                 if self.action != "add" and len(updatedValues) == 0:
@@ -265,7 +265,7 @@
                 if self.action == "add":
                     sqlString += ") VALUES (%s," % cat
                     for value in updatedValues:
-                        sqlString += str(value) + ","
+                        sqlString += value + ","
                     sqlString = sqlString[:-1] # remove last comma
                     sqlString += ")"
                 else:
@@ -327,6 +327,8 @@
                 continue
             if enc:
                 sql = sql.encode(enc)
+            else:
+                sql = sql.encode('utf-8')
             
             driver, database = self.mapDBInfo.GetDbSettings(layer)
             Debug.msg(1, "SQL: %s" % sql)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/vinfo.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/vinfo.py	2014-10-24 15:04:17 UTC (rev 62377)
+++ grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/vinfo.py	2014-10-24 22:48:44 UTC (rev 62378)
@@ -147,7 +147,6 @@
             sql = "SELECT %s FROM %s WHERE %s" % (cols, table, where)
         
         ret = RunCommand('db.select',
-                         parent = self,
                          read = True,
                          quiet = True,
                          flags = 'v',



More information about the grass-commit mailing list