[GRASS-SVN] r69153 - grass/trunk/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 18 07:34:33 PDT 2016


Author: annakrat
Date: 2016-08-18 07:34:33 -0700 (Thu, 18 Aug 2016)
New Revision: 69153

Modified:
   grass/trunk/gui/wxpython/dbmgr/base.py
   grass/trunk/gui/wxpython/dbmgr/dialogs.py
Log:
wxGUI: escape single quotes when editing attributes from GUI, see #2252

Modified: grass/trunk/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/base.py	2016-08-18 14:27:36 UTC (rev 69152)
+++ grass/trunk/gui/wxpython/dbmgr/base.py	2016-08-18 14:34:33 UTC (rev 69153)
@@ -1620,7 +1620,7 @@
                     columnsString += '%s,' % columnName[i]
 
                     if tlist.columns[columnName[i]]['ctype'] == str:
-                        valuesString += "'%s'," % values[i]
+                        valuesString += "'%s'," % values[i].replace("'", "''")
                     else:
                         valuesString += "%s," % values[i]
 

Modified: grass/trunk/gui/wxpython/dbmgr/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/dialogs.py	2016-08-18 14:27:36 UTC (rev 69152)
+++ grass/trunk/gui/wxpython/dbmgr/dialogs.py	2016-08-18 14:34:33 UTC (rev 69153)
@@ -20,6 +20,7 @@
 import os
 import types
 
+import grass.script as gscript
 from core import globalvar
 from core.utils import _
 import wx
@@ -252,7 +253,7 @@
                             if ctype != str:
                                 updatedValues.append(str(newvalue))
                             else:
-                                updatedValues.append("'" + newvalue + "'")
+                                updatedValues.append("'" + newvalue.replace("'", "''") + "'")
                         columns[name]['values'][idx] = newvalue
 
                 if self.action != "add" and len(updatedValues) == 0:



More information about the grass-commit mailing list